python寫數據到外部文件

示例代碼 #一、正確示例,字符列表多行寫 f = open('1abv.txt', 'w') list1 = ['1', '2', '3'] f.writelines(list1) f.close() #二、錯誤示例,必需要是string類型的 f = open('1abv.txt', 'w') list1 = [1, 2, 3] f.writelines(list1) f.close() 3、正
相關文章
相關標籤/搜索