我有这段代码,出于某种原因,Visual Studio是filename
print filename
中的invalid syntax
所说"意外的令牌文件名"。当我尝试编译它时抛出import os
for filenames in os.listdir(r'C:\Users\output'):
for filename in filenames:
print filename
。
filename
{I}如何申报Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensio
ns\Microsoft\Python Tools for Visual Studio\2.1\visualstudio_py_util.py", line 1
06, in exec_file
exec_code(code, file, global_variables)
File "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensio
ns\Microsoft\Python Tools for Visual Studio\2.1\visualstudio_py_util.py", line 8
1, in exec_code
code_obj = compile(code, file, 'exec')
File "C:\Users\user\Selenium\stockDataFormater(PY)\stockDataFormater(PY)\stock
DataFormater.py", line 5
print filename
^
SyntaxError: invalid syntax
,因为我刚才宣布它为行?
完整错误消息:
{{1}}