相关疑难解决方法(0)

AttributeError:'_ io.TextIOWrapper'对象没有属性'next'python

我正在使用python 3.3.3.我正在从tutorialspoint.com上做教程.我无法理解这个错误是什么.

这是我的代码:

fo = open("foo.txt", "w")
print ("Name of the file: ", fo.name)

# Assuming file has following 5 lines
# This is 1st line
# This is 2nd line
# This is 3rd line
# This is 4th line
# This is 5th line

seq = ["This is 6th line\n", "This is 7th line"]
# Write sequence of lines at the end of the file.
fo.seek(0, 2)
line = fo.writelines( seq )

# Now read complete file from …
Run Code Online (Sandbox Code Playgroud)

python

19
推荐指数
2
解决办法
3万
查看次数

标签 统计

python ×1