文件内容xixi.txt
aaa 123 ccc
bbb 456 ddd
读取文件的第三列
with open('xixi.txt','r', encoding='utf-8') as f: for item in f: data=(item.split()) len(data) print( '%s' %(data[2]))
返回:
ccc
ddd
文件内容xixi.txt
aaa 123 ccc
bbb 456 ddd
读取文件的第三列
with open('xixi.txt','r', encoding='utf-8') as f: for item in f: data=(item.split()) len(data) print( '%s' %(data[2]))
返回:
ccc
ddd