pydev - Some beginner error I don't understand in python -
so here's code, copied character character codecademy, , tried altering it, same error. i'm aware codecademy utilising python 2, differences wouldn't big basic "%s" wouldn't work!
from datetime import datetime = datetime.now() print ("%s + %s + %s") % (now.year, now.month, now.day)
and error message:
traceback (most recent phone call last): file "c:\users\sunil\desktop\beginning programming\java\workspace\helain\src\packag\__init__.py", line 5, in <module> print ("%s + %s + %s") % (now.year, now.month, now.day) typeerror: unsupported operand type(s) %: 'nonetype' , 'tuple'
what error making?
in python 3, print
function, code calls print("%s + %s + %s")
, applies %
result of call, none.
try print ("%s + %s + %s" % (now.year, now.month, now.day))
python pydev
No comments:
Post a Comment