[英]Getting an invalid syntax error
Apologies in advance for what I know will be a simple problem. 事先为我所知道的道歉将是一个简单的问题。 I'm a total beginner to Python, but have decided to use it to write a mapreduce doing sentiment analysis.
我是Python的初学者,但已决定使用它编写可进行情感分析的mapreduce。
I have taken a python file from this link: http://www.alex-hanna.com/tworkshops/lesson-6-basic-sentiment-analysis/ to give me guidance and am trying to run it. 我从此链接中获取了一个python文件: http : //www.alex-hanna.com/tworkshops/lesson-6-basic-sentiment-analysis/为我提供指导并正在尝试运行它。 The code for the particular thing I have problems with is:
我遇到的特定问题的代码是:
…
if len(sys.argv) < 2:
print "Usage: avgNReduce.py "
sys.exit(0)
…
The error is: 错误是:
if len(sys.argv) < 2:
^
SyntaxError: invalid syntax
I'm assuming this is a basic problem to resolve, but despite googling it I don't really know how I'm meant to fix this. 我假设这是一个要解决的基本问题,但是尽管使用了谷歌搜索功能,但我真的不知道该怎么解决。 I've tried using a colon instead of a semi colon and have ensured the ampersand was correct from the copying over.
我尝试使用冒号而不是半冒号,并确保从复制开始,&符是正确的。 Any ideas?
有任何想法吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.