2024-10-01 22:42:18 发布
网友
我有一个文件,看起来像alt text http://img40.imageshack.us/img40/4581/crapq.png 现在显示了5条线。但是运行此脚本
with open('hello.txt', 'r') as hello: for line in hello: print line,
给予
仅此而已。如何读取整个文件?TIA公司
entire_file = open('hello.txt', 'rb').read() print 'number of \\n: %d, number of bytes %d' % ( entire_file.count('\n'), len(entire_file))
相关问题 更多 >
编程相关推荐