-2
#!/usr/bin/python
def creating_table():
mailingTable = open("mailingTable.txt", "r")
lines = mailingTable.readline()
for line in lines:
    print line
mailingTable.close()

It says print line is invalid syntax. Why? I m using python 3.3.5

ERJAN
  • 23,696
  • 23
  • 72
  • 146

1 Answers1

4

In Python 3.x, you have to write print() as follows, because now it's a function:

print(line)

In Python 2.x it was possible to omit the (), but that's no longer the case.

Óscar López
  • 232,561
  • 37
  • 312
  • 386