我正在尝试使用下面的Python脚本计算单词。
import os
os.chdir('D:\ECP\TAT')
filename = 'D:\ECP\TAT\Test.txt'
numlines = 0
with open (filename,'r') as file:
for l in file:
Wordlist = l.split()
numlines+=1
print("Wordlist")
但我收到错误:
FileNotFoundError: [Errno 2] No such file or directory: 'D:\\ECP\\TAT\\Test.txt'
IDE : Anaconda (Jupyter) python : 3.6
答案 0 :(得分:0)
import os
os.chdir('D:\\ECP\\TAT\\')
filename = 'D:\\ECP\\TAT\\Test.txt'
numlines = 0
with open (filename,'r') as file:
for l in file:
Wordlist = l.split()
numlines+=1
print(Wordlist)