SyntaxError when unpacking elements of iterables

1
line = 'nobody:*:-2:-2:Unprivileged User:/var/empty:usr/bin/false'
uname, *fields, homedir, sh=line.split(':')
print fields

I was doing studies in Python and I'll deal with the line so, when trying to compile I get the following message

SyntaxError: Missing parentheses in call to 'print'  

Why is this happening? I'm using the cookbook.

    
asked by anonymous 04.12.2015 / 12:14

1 answer

1

In python 3, print is used with parentheses:

print("A resposta é:", 2*2)
    
04.12.2015 / 18:19