使用Anaconda Jupyter

时间:2017-10-25 06:39:12

标签: python anaconda

我正在尝试使用下面的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

1 个答案:

答案 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)