获取此错误 我的输入文件是
def get_data_from_file(file_path=os.path.('C:/Users/anees/chatbot_data.txt')):
with open(file_path) as infile:
cleaned_lines = [line.strip() for line in infile if not line.startswith(('$$$', '###', '==='))]
return cleaned_lines
错误
C:\Users\anees\Anaconda3\envs\chatbot\python.exe C:/Users/anees/PycharmProjects/Web_analytics/Assignment1/knowlege_extraction.py
Traceback (most recent call last):
File "C:/Users/anees/PycharmProjects/Web_analytics/Assignment1/knowlege_extraction.py", line 245, in <module>
main()
File "C:/Users/anees/PycharmProjects/Web_analytics/Assignment1/knowlege_extraction.py", line 218, in main
triples = cl.extract_triples(sents)
File "C:\Users\anees\Anaconda3\envs\chatbot\lib\site-packages\pyclausie-0.1-py2.7.egg\pyclausie\SubprocessBackend.py", line 62, in extract_triples
stderr=subprocess.PIPE)
File "C:\Users\anees\Anaconda3\envs\chatbot\lib\subprocess.py", line 390, in __init__
errread, errwrite)
File "C:\Users\anees\Anaconda3\envs\chatbot\lib\subprocess.py", line 640, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
Process finished with exit code 1
试试看
修路。你知道吗
如果您提供的是完整路径,则不需要使用操作系统路径连接()只需使用文件路径,如下所示:
file_path=r'C:/Users/anees/chatbot_data.txt'
或者可以使用
os.path.join()
,如下所示:相关问题 更多 >
编程相关推荐