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
什么情况呢?
2 回答5.1k 阅读✓ 已解决
2 回答1.1k 阅读✓ 已解决
4 回答972 阅读✓ 已解决
3 回答1.1k 阅读✓ 已解决
3 回答1.2k 阅读✓ 已解决
1 回答1.7k 阅读✓ 已解决
1 回答1.2k 阅读✓ 已解决
你的python版本应该是2.X吧?请试试把权限部分的'rw'改成'r+'