Getting an invalid syntax error

mapreduce, python

Solution

You're looking for the `<` operator there instead of `lt`. (`lt` stands for the less than operator in HTML, see this thread.)

if len(sys.argv) < 2:
    print "Usage: avgNReduce.py "
    sys.exit(0)

Problem

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. 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. The code for the particular thing I have problems with is: ``` … if len(sys.argv) &lt; 2: print "Usage: avgNReduce.py " sys.exit(0) … ``` The error is: ``` if len(sys.argv) &lt; 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?

Original source

Related problems