file_object = open('thefile.txt')
try:
  all_the_text = file_object.read().decode("gb2312")
finally:
  file_object.close()
return all_the_text

 

注:file_object.read().decode("gb2312") 可以解决中文乱码问题

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-03
  • 2022-01-21
  • 2022-01-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-29
  • 2021-08-01
  • 2021-05-10
相关资源
相似解决方案