摘要: Linux 阅读全文
posted @ 2019-07-11 18:00 刘岗 阅读(60) 评论(0) 推荐(0)
摘要: from threading import Thread,Lockimport os,timedef work(lock): global n with lock: temp=n time.sleep(0.1) n=temp-1 n=temp-1if __name__ == '__main__': 阅读全文
posted @ 2019-03-04 21:20 刘岗 阅读(162) 评论(0) 推荐(0)
摘要: 函数 形参:定义的函数; 实参:调用的函数,与形参一一对应; 传参:实参到形参的过程; return:函数的返回值 return返回的是调用者的值,即func()=1 ; 阅读全文
posted @ 2019-01-16 20:01 刘岗 阅读(107) 评论(0) 推荐(0)
摘要: 深浅拷贝: li = [1,2,3,4,[5,6,7]] # 浅拷贝只拷贝一层元素 lst = li.copy() print(li) print(lst) 对于复杂对象(嵌套)list =[1,2,3,[4,5,6]] copy只能copy主对象,对于子对象copy等同于赋值(或理解为引用) 阅读全文
posted @ 2019-01-10 21:31 刘岗 阅读(129) 评论(0) 推荐(0)
摘要: 字符串:s1 = 'Alex's1 = s.capitalize() # 首字母大写s2 = s.upper() # 全部大写s3 = s.lower() # 全部小写print(s.count('L')) # 返回的是数量print(s.endswith('x')) # 以什么结尾print(s. 阅读全文
posted @ 2018-12-29 15:48 刘岗 阅读(154) 评论(0) 推荐(0)