Python零基礎學習筆記(三十二)——list/tuple/dict/set檔案操作

我是王佳俊發表於2019-01-25
vimport pickle #資料永續性模組

Mylist = [1, 2, 3, 44, "aaa", True]

path = r"C:UsersAdministratorPycharmProjectsuntitledday011檔案讀寫file2.txt"

f = open(path, "wb")
pickle.dump(Mylist, f)
f.close()

#讀取
f1 = open(path, "rb")
tempList = pickle.load(f1)
print(tempList)
f1.close()


相關文章