Pavel Angelov
Pavel Angelov

Reputation: 1

Python error - Invalid syntax

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!

Upvotes: 0

Views: 293

Answers (3)

kul_mi
kul_mi

Reputation: 1151

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

Upvotes: 0

med_alpa
med_alpa

Reputation: 292

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

print (1+3)

Upvotes: 1

falsetru
falsetru

Reputation: 368954

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.

Upvotes: 1

Related Questions