首页 > 解决方案 > 从 txt 文件读取时,为什么 python 不显示所有行?

问题描述

从 8000 行的 txt 文件中读取时,只显示前 159 行,我想知道为什么会这样?

path = 'somepath/somefile.txt'

with open(path) as f:
    text = f.read()
print(text)

打印文本时,预期结果是显示文件中包含的所有 8000 行。

结果是打印文本时显示 159/8000 行。

标签: pythonfilereadfile

解决方案


推荐阅读