file_object = open(r"/root/py_test/web01/src/ftime",'rw')
try:
print file_object.read()
file_object.write('test')
finally:
file_object.close( )
读取一个文件,内容就一行
然后再写入,报错。
IOError
IOError: [Errno 9] Bad file descriptor
什么情况呢?
file_object = open(r"/root/py_test/web01/src/ftime",'rw')
try:
print file_object.read()
file_object.write('test')
finally:
file_object.close( )
读取一个文件,内容就一行
然后再写入,报错。
IOError
IOError: [Errno 9] Bad file descriptor
什么情况呢?
4 回答4.4k 阅读✓ 已解决
4 回答3.8k 阅读✓ 已解决
1 回答3k 阅读✓ 已解决
3 回答2.1k 阅读✓ 已解决
1 回答4.5k 阅读✓ 已解决
1 回答3.8k 阅读✓ 已解决
1 回答2.8k 阅读✓ 已解决
你的python版本应该是2.X吧?请试试把权限部分的'rw'改成'r+'