python读取txt文件
如何读取文件内容?
file = open('致橡树.txt', 'r', encoding='utf-8')
print(file.read())
file.close()
按行读取
import time
file = open('致橡树.txt', 'r', encoding='utf-8')
for line in file:
print(line, end='')
time.sleep(0.5)
file.close()
file = open('致橡树.txt', 'r',
原创
2021-04-26 14:36:08 ·
412 阅读 ·
1 评论