[Solved] What is wrong with the syntax of this code? [duplicate]


In python 3, print is a function. See here: https://docs.python.org/3/whatsnew/3.0.html#print-is-a-function

Try:

with open('list.txt') as f:
    print(" ".join(line.strip() for line in f))

solved What is wrong with the syntax of this code? [duplicate]