摘要: 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) 编辑
摘要: 1 class Solution(object): 2 def twoSum(self, nums, target): 3 """ 4 :type nums: List[int] 5 :type target: int 6 :rtype: List[int] 7 """ 8 d... 阅读全文
posted @ 2018-03-03 19:03 TomoFan 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 自动补全代码 option+/ 上一条命令 control+P下一条命令 control+N 添加多行注释 control + 3 加缩进 Command + ]减缩进 Command + [ shell 中换行编写 4个空格+enter(直接enter将编译程序) 阅读全文
posted @ 2018-02-25 18:19 TomoFan 阅读(420) 评论(0) 推荐(0) 编辑
摘要: set与数学中集合的定义一样 具有互异性和无序性(没有索引) 重复元素在Set中自动被过滤: 阅读全文
posted @ 2017-12-01 18:41 TomoFan 阅读(117) 评论(0) 推荐(0) 编辑