Python writelines newline. Copy. lines = ['line1', 'line2'] with open('filename.txt', 'w') as f: f.writelines("%s\n" % l for l in lines).
確定! 回上一頁