Python中的文件基礎

1、打開文件:建立程序與文件的聯繫 file_obj=open(filename,mode) Filename: 原字符串 r’c:\temp\text.t’ 轉義字串 ‘c:\temp\text.t’ Mode R 讀取 W 寫入 2、讀寫文件 Var=file_obj.read() 全部讀回來 read string 返回所有string(一次性讀完) 讀一行 readline string
相關文章
相關標籤/搜索