#!/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
#!/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
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.