datetime - Getting the date before with python -


i want yesterday's date, error:

typeerror: unsupported operand type(s) -: 'builtin_function_or_method' , 'datetime.timedelta' 

code:

import datetime      today = datetime.date.today     day = datetime.timedelta(days = 1)     yesterday = today - day 

you have use (). way not creating reference method , getting "builtin_function_or_method" rather, calling , getting datetime object:

import datetime  today = datetime.date.today() day = datetime.timedelta(days = 1) yesterday = today - day 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -