python 文件相关操作
filename = 'pi_digits.txt'
with open(filename) as a:
lines = a.readlines()
print(lines)
# 在外面也可以用lines变量
for line in lines:
print(line.rstrip())
for line in lines:
print(line)
filename = 'programming.txt'
# 'w' 模式会清空已经存在的文件
with open(f...
somelearningnote.hashnode.dev1 min read