上一页 1 ··· 9 10 11 12 13 14 15 下一页
摘要: (1, 2, 3, 4, 5, 5)(1, 2, 4, 5, 5)1(2, 3, 4, 5, 6){'name': 'lian', 'age': 8, 'sex': 'f'}lian8{'name': 'lian', 'age': 8}lian8Lian{'age': 18, 'sex': 'm'} 阅读全文
posted @ 2018-11-06 15:03 rongye 阅读(118) 评论(0) 推荐(0) 编辑
摘要: in the test1in the test2in the test3None0(1, 'hello', ['alex', 'wupeiqi'], {'name': 'alex'}) 阅读全文
posted @ 2018-11-06 11:48 rongye 阅读(140) 评论(0) 推荐(0) 编辑
摘要: import timedef logger(): time_format = '%Y-%m-%d %X' time_current = time.strftime(time_format) with open('a.txt','a+') as f: f.write('%s end action\n' 阅读全文
posted @ 2018-11-06 11:33 rongye 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 详细文章: http://www.cnblogs.com/yuanchenqi/articles/5956943.html http://www.diveintopython3.net/strings.html 需知: 1.在python2默认编码是ASCII, python3里默认是unicode 阅读全文
posted @ 2018-11-06 10:18 rongye 阅读(298) 评论(0) 推荐(0) 编辑
摘要: 为了避免打开文件后忘记关闭,可以通过管理上下文,即: 1 2 3 with open('log','r') as f: ... 1 2 3 with open('log','r') as f: ... 1 2 3 with open('log','r') as f: ... 1 2 3 with o 阅读全文
posted @ 2018-11-06 09:53 rongye 阅读(128) 评论(0) 推荐(0) 编辑
摘要: #逐行读写f = open('yesterday','r',encoding='utf-8')f_new = open('yesterday3','w',encoding="utf-8")for line in f: if '等我享受' in line: line = line.replace('等 阅读全文
posted @ 2018-11-06 09:44 rongye 阅读(130) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python#data = open("yesterday",encoding="utf-8").read()f = open("yesterday",'r',encoding="utf-8")#文件句柄,参数w为创建一个文件,#参数r为读,参数a为追加,可写#参数r+ 阅读全文
posted @ 2018-11-05 22:26 rongye 阅读(133) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env pythonimport sys,timefor i in range(50): sys.stdout.write('#') sys.stdout.flush() time.sleep(0.1) 阅读全文
posted @ 2018-11-05 21:54 rongye 阅读(107) 评论(0) 推荐(0) 编辑
摘要: {1, 3, 4, 5, 6, 7, 9} {0, 2, 66, 4, 6, 8, 22}{4, 6}{4, 6}{0, 1, 2, 3, 4, 5, 6, 7, 66, 9, 8, 22}{0, 1, 2, 3, 4, 5, 6, 7, 66, 9, 8, 22}{1, 3, 5, 7, 9}{1 阅读全文
posted @ 2018-11-05 20:43 rongye 阅读(152) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env pythondata = { '北京':{ "昌平":{ "沙河":["oldboy","test"], "天通苑":["链家地产","我爱我家"] }, "朝阳":{ "望京":["奔驰","陌陌"], "国贸":{"CICC","HP"}, "东直门" 阅读全文
posted @ 2018-11-04 20:10 rongye 阅读(369) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 下一页