摘要: # 修改文件 # 文件是不能修改 with open('小护士班主任', mode='r', encoding='utf-') as f, open('小护士班主任.bak', 'w', encoding='utf-8') as f2: for line in f: if '星儿' in line: line = line.replace(... 阅读全文
posted @ 2019-02-26 23:45 云川望雨 阅读(233) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python # -*- coding:utf-8 -*- #str --->byte encode 编码 s = '二哥' b = s.encode('utf-8') print(b) #byte --->str decode 解码 s1 = b.decode('utf-8') print(s1) s = '春哥' b = s.encode('utf-8... 阅读全文
posted @ 2019-02-26 22:44 云川望雨 阅读(66) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python # -*- coding:utf-8 -*- # 绝对路径的文件 # T_file = open('d:\江豚.txt', mode='r', encoding='gbk') # content = T_file.read() # print(content) # T_file.close() # open操作封装了 bytes ---> str... 阅读全文
posted @ 2019-02-26 22:43 云川望雨 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 基础数据类型汇总: 集合: 深浅拷贝: 阅读全文
posted @ 2019-02-26 22:41 云川望雨 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 编码方式总结: 阅读全文
posted @ 2019-02-26 22:38 云川望雨 阅读(119) 评论(0) 推荐(0) 编辑