在IDLE命令行引用一文件夹下的函数,来了条错误提示:FileNotFoundError: [Errno 2] No such file or directory: 'testSet.txt'
错误的原因:工作路径没有切换到这个TXT文件所在的文件夹下;
解决方法是在命令行敲入以下几行代码:
>>> import os
>>> print os.getcwd() // 打印出当前工作目录
>>> os.chdir('the dir which include the file a.txt') #修改当前工作目录