0
什麼是 「更Python」/更有效的/更好:比較不同writeln 「實現」
fp.write(some_long_string)
fp.write('\n')
或
fp.write(some_long_string + '\n')
或
fp.writelines([some_long_string])
什麼是 「更Python」/更有效的/更好:比較不同writeln 「實現」
fp.write(some_long_string)
fp.write('\n')
或
fp.write(some_long_string + '\n')
或
fp.writelines([some_long_string])
如果你能離開,不函數調用:
print >>fp, some_long_string
'writelines'不添加換行符 –
[爲什麼Python語言沒有writeln()方法?](http://stackoverflow.com/questions/2575619/why-python-language-does-not-具有-A-writeln方法) – georg