Syntaxerror when unpacking elements of iterables

Asked

Viewed 50 times

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 will stop 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 Cookbook

  • Missing parentheses.

1 answer

1


In python 3 print is used with parentheses:

print("A resposta é:", 2*2)
  • Great, I was used to the 2.7x

Browser other questions tagged

You are not signed in. Login or sign up in order to post.