I had a problem understanding why unpacking doesn't work with list and print operator in Python 2.7:
>>> l=['a', 'b', 'c']
>>> print (*l, sep='')
Python 3.x works fine and prints:
abc
Python 2.7, however, raises an error:
print (*l, sep='')
^
SyntaxError: invalid syntax
How can I make it work for Python 2.7?
I know that I can alternatively encode it using join: ''.join(l)
source
share