为什么我无法读取我刚刚写入文本文件的内容。该代码没有显示任何错误,但我无法阅读我刚刚写入文档的内容。如果有人可以帮助我解决这个问题,那就太好了。顺便说一句,我是编程新手,如果这是一个简单的问题,请原谅我。我使用的是 Python 2.6.1 版
from sys import argv
script,file_name = argv
prompt = "> "
target = open(file_name, 'w+b')
print "press CRTL-C enter to escape this"
print "or press RETURN to continue"
raw_input(prompt)
print "Begin erasing stuff Goodbye!"
target.truncate()
print "we are going to start writing to file"
write_1 = raw_input(prompt)
write_2 = raw_input(prompt)
write_3 = raw_input(prompt)
target.write(write_1)
target.write(write_2)
target.write(write_3)
print target.read()
print "closing now!"
target.close()