python簡單文本文件讀取

Python讀寫文件 1.open 使用open打開文件後必定要記得調用文件對象的close()方法。好比能夠用try/finally語句來確保最後能關閉文件。 file_object = open('thefile.txt') try: all_the_text = file_object.read( ) finally: file_object.close( ) 注:不
相關文章
相關標籤/搜索