摘要:
(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'} 阅读全文
摘要:
in the test1in the test2in the test3None0(1, 'hello', ['alex', 'wupeiqi'], {'name': 'alex'}) 阅读全文
摘要:
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' 阅读全文
摘要:
详细文章: http://www.cnblogs.com/yuanchenqi/articles/5956943.html http://www.diveintopython3.net/strings.html 需知: 1.在python2默认编码是ASCII, python3里默认是unicode 阅读全文
摘要:
为了避免打开文件后忘记关闭,可以通过管理上下文,即: 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 阅读全文
摘要:
#逐行读写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('等 阅读全文