python逐行处理文件
In Python, how to process read a file line by line to process it?
Like those lines in Bash:
就像Bash中的那些行一样:
while read line ; do
echo $line
done < ./input.txt
In Python, you can process a file line by line by a for
in the file like
在Python中,你可以通过一个过程,文件里逐行for
像文件中
with open("./input.txt", "r") as thefile:
for line in thefile:print line
Answered by timyang.
timyang回答。
翻译自: https://www.systutorials.com/how-to-process-a-file-line-by-line-in-python/
python逐行处理文件