摘要:
# with代码块执行完毕后,内部会自动关闭并释放文件资源with open('wuenda.txt','r',encoding='utf-8') as f1, \ open('test.txt','r',encoding='utf-8') as f2: for line in f1: print( 阅读全文
posted @ 2018-01-23 21:23
cecelia
阅读(128)
评论(0)
推荐(0)
摘要:
1.f=open('wuenda.txt','a',encoding='utf-8') #文件句柄 a:追加 w:覆盖写,r:读f.write('when I was young\n I listen to the radio\n他们搬去哪了?\n')#读:在r模式下 2.f=open('wuend 阅读全文
posted @ 2018-01-23 17:18
cecelia
阅读(167)
评论(0)
推荐(0)
摘要:
#集合:1.去重 2.关系测试:交集、并集、差集list_1=[1,2,4,5,6,3,3,2,5]list_1=set(list_1)print(list_1,type(list_1))list_2=[2,4,6,8,9]list_2=set(list_2)print(list_2) #交集pri 阅读全文
posted @ 2018-01-23 10:44
cecelia
阅读(143)
评论(0)
推荐(0)

浙公网安备 33010602011771号