请问如何使用readlines来提取txt中的文件
如题,本人的作业。实在是毫无头绪https://www.dropbox.com/s/vx4y2ylgaihw0b2/%E5%B1%8F%E5%B9%95%E6%88%AA%E5%9B%BE%202016-10-14%2004.11.54.png?dl=0https://www.dropbox.com/s/zhrp2oln3t5labe/%E5%B1%8F%E5%B9%95%E6%88%AA%E5%9B%BE%202016-10-14%2004.11.44.png?dl=0 file_name = 'data.txt'
try:
with open(file_name) as f:
data = f.readlines()
except FileNotFoundError:
print(file_name + 'does not exist')
页:
[1]