我昨天剛開始用 python 編程。最終我想打開一個逗號分隔的文件并閱讀其內容。我搜索了相關主題并嘗試使用一些代碼,但遇到了一些錯誤。代碼:def ReadTxtFile(): fname="c:\vba\lapseC2.csv" #with open(fname) as f: with open("c:\vba\lapseC2.csv", "r") as f: content = f.readlines您可能還想刪除\n每行末尾的空格字符content = [x.strip() for x in content] ReadTxtFile()錯誤:OSError: [Errno 22] 無效參數: 'c:\x0bba\lapseC2.csv'
添加回答
舉報
0/150
提交
取消