Datawhale學習計劃:python基礎第六期-任務5

1.file a.打開文件方式(讀寫兩種方式) 1)讀文件 要以讀文件的模式打開一個文件對象,使用Python內置的open()函數,傳入文件名和標示符: f = open( '/Users/Esther/test.txt', 'r' ) 如果文件不存在,open()函數會顯示錯誤: Traceback (most recent call last): File "C:/Users/qw/.P
相關文章
相關標籤/搜索