open("","r")與open("","rb")的效率區別

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

耗時 25.6074296742sfile

 

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

耗時 60.840389834系統

有文章提到說在windows系統中,要加上rb,不然代碼會很慢,但經過上面,發現rb明顯更慢。文章

相關文章
相關標籤/搜索