python筆記學習 第1篇 【文件讀寫】

讀文件 打開文件 讀文件 關閉文件 file1 = open(’/Users/motanyuan/Desktop/abc.txt’,‘r’,encoding=‘utf-8’) #打開文件 filecontent = file1.read() # 讀文件 print(filecontent) # 打印文件內容 file1.close() # 關閉文件 寫文件 覆蓋原來內容的寫 打開文件 寫文件 關閉
相關文章
相關標籤/搜索