[Tutor] library terminology and importing
street.sweeper at mailworks.org
street.sweeper at mailworks.org
Sun Feb 21 09:43:29 EST 2016
Hello all,
I often use now() and strftime() from datetime, but it seems like I
can't import just those functions. The os module allows me to import
like this:
from os.path import join,expanduser
but I get an error if I try
from datetime.datetime import now, strftime
But if I import all of os and datetime, I can use those functions by
writing the full 'path' 3 levels deep:
os.path.expanduser('~')
datetime.datetime.now()
Is there a way to import individual functions from datetime.datetime?
Also, is there proper terminology for each of the 3 sections of
os.path.expanduser('~') for example? Such as
os - library (or module?)
path - ?
expanduser - function
Thanks!
More information about the Tutor
mailing list