1
我有一个文件,看起来像这样alt text http://img40.imageshack.us/img40/4581/crapq.png 现在显示了5行。但是运行此脚本阅读python中的损坏文件
with open('hello.txt', 'r') as hello:
for line in hello:
print line,
给
num 1
ctl00$header1$Login1$txtUserName=ыют;CBШ▌
,这一切。我怎样才能读取整个文件? TIA
@roddik:是的,将'b'标志添加到open()以表明您希望将该文件作为二进制文件(例如字节序列)处理。 – 2010-01-23 18:51:28