-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
  • 22,540
  • 20
  • 65
  • 127

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
  • 225,348
  • 35
  • 301
  • 374