登录

python - datetime时间输出的问题

1在codecademy上学习PYTHON基础知识 学到 datetime

运行了一下代码:

from datetime import datetime
now=datetime.now()
#print now
print now.year
print now.month
print now.day
print now.time"

输出的问题是:  年 月 日 都没问题 就是 时间那里 不知道是啥意思。

'''2017
5
15
<built-in method time of datetime.datetime object at 0x7f7bd75f7f30>
None
# Python
ringa_leeringa_lee2047 天前629 次浏览

全部回复(2) 我要回复

  • PHPzhong

    PHPzhong2017-05-18 10:48:51

    from datetime import datetime
    now=datetime.now()
    #print now
    print now.year
    print now.month
    print now.day
    print now.hour
    print now.minute
    print now.second
    print now.microsecond

    没有time属性

    print now.date()
    print now.time()
    print now.timetuple()
    print now.ctime()

    回复
    0
  • 習慣沉默

    習慣沉默2017-05-18 10:48:51

    print now.tiem()

    回复
    0
  • 取消回复发送