Python
melody_zkm
这个作者很懒,什么都没留下…
展开
-
Python面试题详解--字符串操作
1. 从字符串中找出第一个重复的字符 比如"abcdefgabcdefg"第一个重复的字符是’a’ 遍历字符串,将字符存入新的列表中, 如果字符在新的列表中存在, 则返回该字符 def get_first_duplicated_char(string): uniq_chars = set() for c in list(string): if c not in ...原创 2020-01-07 12:27:27 · 471 阅读 · 0 评论 -
Python的threading多线程
Python创建线程的两种方式 Python有两种方式创建线程: 一种是创建一个新的类并继承threading.Thread类, 然后重写run()方法; 另外一种是单独编写函数func, 并使用threading.Thread(target=func), 该方法会被run()调用。 下面我们使用线程实现打印一个从begin到end的整数的需求。 继承Thread类创建线程 import thre...原创 2020-01-06 23:31:45 · 169 阅读 · 0 评论