为什么我不能读取我刚刚写入文本文件的内容。该代码不显示任何错误,但我无法阅读我刚写入文档的内容。如果有人能帮我弄清楚这很好。我是新来编程的方式所以请原谅我,如果这是一个简单的疑难问题。现在用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()
感谢您的帮助。 – Valleyvizor 2012-05-01 06:40:35