0

I'm new to python and programming, I have a task to run the following file: http://pastebin.com/UmheVyvV with Python, but I get error on line 163:

line 163
print filename + " "*(80 - len(filename) - len(ln)) + ln + delim,

SyntaxError: invalid syntax

There's a '^' below filename in the error message.

Could anyone tell me how to solve this problem and be able to run the file? Thanks!

1
  • 1
    which version of python ? If 3.x , print is a function. SO, you need to do print(...) Commented Jul 28, 2013 at 17:51

3 Answers 3

1

Replace < with (:

print filename + " "*(80 - len(filename) - len(ln)) + ln + delim,
#                    ^

UPDATE

The code in the given url is written for Python 2.x. It will not work in Python 3.x.

Sign up to request clarification or add additional context in comments.

Comments

1

If you are using python 3. the print statement become a function so you need to put parentheses. example:

print (1+3)

Comments

0

The '^' shows you where the syntax is incorrect. Depending on python version parenthesis should be used.

doc http://docs.python.org/2/tutorial/errors.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.