摘要: 写 只写 # 只写 # utf-8 f = open('us', mode='w', encoding='utf-8') f.write('tonight, i can write down the most beautiful lines') f.close # bytes f = open('u 阅读全文
posted @ 2018-10-08 19:58 phappiness 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 问题 # 会出现索引溢出现象 li = [1, 2, 3, 4, 5] for i in range(li): li.pop(i) print(li) # dictionary false dic = {'k1':'1', 'k2':'2', 'k3':'3'} for i in dic: if ' 阅读全文
posted @ 2018-10-08 17:35 phappiness 阅读(457) 评论(0) 推荐(0) 编辑
摘要: 集合 可变数据类型,内置元素必须是不可变类型,无序,不重复 增 set.add set.update 删 del pop remove clear 查 for 切片 # 集合 # 创建 set1 = set({1,2,3}) # 集合内置元素必须是不可变类型 # set2 = set({1,[2,3 阅读全文
posted @ 2018-10-08 17:05 phappiness 阅读(237) 评论(0) 推荐(0) 编辑