无法运行python脚本 [英] Cannot run python script

查看:299
本文介绍了无法运行python脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行这个python脚本:

I am trying to run this python script:

https://gist.githubusercontent.com/nk9/b150542ef72abc7974cb/raw/4a1e249976c6c330116fc068fb7001e3443c5b8d/largestFiles.py

但是由于某种原因,它包含一堆非法字符,并提供了这个错误:

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…

这篇关于无法运行python脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆