无法运行python脚本
问题描述:
我正在尝试运行这个python脚本:
I am trying to run this python script:
但是由于某种原因,它包含一堆非法字符,并提供了这个错误:
but for some reason it contains a bunch of illegal characters and gives this error:
C:\tools\inspect>python largestFiles.py
File "largestFiles.py", line 28
print "Finding objects larger than {}kB\u2026".format(args.filesExceeding)
^
SyntaxError: invalid syntax
如果我删除我仍然得到的那些非法字符:
If I remove those illegal characters I still get:
C:\tools\inspect>python largestFiles.py
File "largestFiles.py", line 28
print "Finding objects larger than {}".format(args.filesExceeding)
^
SyntaxError: invalid syntax
任何想法?
我使用python 3.4在Windows 8上运行它
I am running it on windows 8 using python 3.4
答
As print
是python 3中的函数,您需要将字符串放在括号中。 https://docs.python.org/3.0/whatsnew /3.0.html#print-is-function
As print
is function in python 3 you need to put your string in parenthesis. https://docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function
>>> print ("Finding objects larger than kB\u2026")
Finding objects larger than kB…