Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/340.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
升华文本2和Repl运行python_Python_Path_Sublimetext2_Sublimerepl - Fatal编程技术网

升华文本2和Repl运行python

升华文本2和Repl运行python,python,path,sublimetext2,sublimerepl,Python,Path,Sublimetext2,Sublimerepl,我开始使用Sublime Text 2和REPL,但遇到了一些问题。 当我运行该文件时,它告诉我该文件不存在。如果脚本是直接从终端构建的,那么它就可以完美地工作 代码 def stopwords(text): with open('danish', 'rU') as f: for line in f: text = text.replace(' '+line.strip()+' ', "") return text 日志 IOError:

我开始使用Sublime Text 2和REPL,但遇到了一些问题。 当我运行该文件时,它告诉我该文件不存在。如果脚本是直接从终端构建的,那么它就可以完美地工作

代码

def stopwords(text):
    with open('danish', 'rU') as f:
        for line in f:
            text = text.replace(' '+line.strip()+' ', "")
    return text
日志

IOError: [Errno 2] No such file or directory: 'danish'
我尝试过类似于
os.chdir(os.path.dirname(os.path.abspath(sys.argv[0]))和
重新加载(sys)
\uuu文件
的方法,但它们都不起作用

你知道为什么在运行Sublime Text 2 REPL时,
\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu