#讀取目前目錄下所有檔案的文字內容 import os folder = os.getcwd() print('目前目錄=',folder) a1 = os.listdir() for i in a1: if os.path.isfile(i)==True: file = open(i,'rt',encoding='utf-8') txt = file.read() print(txt) folder.close() a1.close() file.close()