0%
简介
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
def process(sting): print('Process is :',sting)
with open('somefile.txt')as f: for line in f: process(line)
for line in open('somefile.txt'): process(line)
f = open('somefile.txt','w') print('apple','app','abc',file=f) print('would','you','like',file=f) f.close()
lines = list(open('somefile.txt')) print(lines)
|