摘要: def validate_pin(pin): if (len(pin) == 4 or len(pin) ==6): for i in pin: flag = True if i not in ['1','2','3','4','5','6','7','8','9','0']: ... 阅读全文
posted @ 2018-03-11 20:06 TomoFan 阅读(237) 评论(0) 推荐(0) 编辑
摘要: import re def count_smileys(arr): index = 0 res = 0 #遍历列表 while index < len(arr): #找出字符串中带有 眼,嘴,或鼻子的项 if arr[index].count(':') + arr[index].count(';') == 1 \ ... 阅读全文
posted @ 2018-03-11 20:01 TomoFan 阅读(300) 评论(0) 推荐(0) 编辑
摘要: class Solution(object): def lengthOfLongestSubstring(self, s): """ :type s: str :rtype: int """ # 当s长度为0或1时 if len(s) == 0: return 0 ... 阅读全文
posted @ 2018-03-11 18:05 TomoFan 阅读(292) 评论(0) 推荐(0) 编辑