Python读文本文件
file_object = open('thefile.txt')
try:
all_the_text = file_object.read()
finally:
file_object.close()
return all_the_text
注:file_object.read().decode("gb2312") 可以解决中文乱码问题
file_object = open('thefile.txt')
try:
all_the_text = file_object.read()
finally:
file_object.close()
return all_the_text
注:file_object.read().decode("gb2312") 可以解决中文乱码问题