0
我正在嘗試在文件中寫入列表。我用:使用Python將文件列表寫入文件
studentFile = open("students1.txt", "w")
for ele in studentList:
studentFile.write(str(ele) + "\n")
studentFile.close()
結果,產量爲:
['11609036', 'MIT', 'NE']
['11611262', 'MIT', 'MD']
['11613498', 'BIS', 'SA']
代替:
11609036 MIT NE
11611262 MIT MD
11613498 BIS SA
我怎樣才能解決呢?
謝謝。它工作完美。 – Dennis