fd = open("C:\Users\william\Desktop\dup_file - Copy (3).txt","r")
for i in fd:
print i

耗时 25.6074296742s

 

fd = open("C:\Users\william\Desktop\dup_file - Copy (3).txt","rb")
for i in fd:
print i

耗时 60.840389834

有文章提到说在windows系统中,要加上rb,否则代码会很慢,但通过上面,发现rb明显更慢。

相关文章:

  • 2022-12-23
  • 2021-11-30
  • 2021-12-23
  • 2022-12-23
  • 2021-10-16
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
  • 2021-10-30
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案