Почему два раза пишется datetime?
Добрый день я совсем новичок в программирование можете оябснить что озночате этот код
import datetime
a = datetime.datetime.today()
b = datetime.datetime.now()
print(a)
print(b)
Почему два раза пишется datetime?
Ответы (1 шт):
Автор решения: Victor VosMottor thanks Monica
→ Ссылка
datetime — это встроенный объект в одноименный модуль datetime.
Методы now() и today() находятся в объекте, а не в "корне" модуля.
source code of module
Help on module datetime:
NAME
datetime - Fast implementation of the datetime type.
MODULE REFERENCE
https://docs.python.org/3.7/library/datetime
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
CLASSES
builtins.object
date
datetime
time
timedelta
tzinfo
timezone