Python的time模块常用功能函数复习



>>> import time
>>>
>>> print time.time
<built-in function time>
>>>
>>>
>>> print time.time()
1516845123.6
>>>
>>> print time.ctime()
Thu Jan 25 09:52:13 2018
>>>
>>> print time.localtime()
time.struct_time(tm_year=2018, tm_mon=1, tm_mday=25, tm_hour=9, tm_min=52, tm_se
c=28, tm_wday=3, tm_yday=25, tm_isdst=0)
>>>>>>
>>> import time
>>>
>>> print time.time
<built-in function time>
>>>
>>>
>>> print time.time()
1516845123.6
>>>
>>> print time.ctime()
Thu Jan 25 09:52:13 2018
>>>
>>> print time.localtime()
time.struct_time(tm_year=2018, tm_mon=1, tm_mday=25, tm_hour=9, tm_min=52, tm_se
c=28, tm_wday=3, tm_yday=25, tm_isdst=0)
>>>
>>> time.strftime()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: strftime() takes at least 1 argument (0 given)
>>>
>>> time.strftime("%Y-%m-%d")
'2018-01-25'
>>>
>>> time.strftime("%Y-%m-%d %H:%M:%S",time.localtime())
'2018-01-25 16:01:50'


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值