吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 714|回复: 2
收起左侧

[求助] python time方法疑惑

[复制链接]
ajieup 发表于 2021-5-8 09:54
time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
time.strftime("%Y-%m-%d %H:%M:%S")
为什么这两个执行结果是一样的呢

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

kof21411 发表于 2021-5-8 09:59
因为time.strftime("%Y-%m-%d %H:%M:%S")默认调用参数就是time.localtime()
gentlespider 发表于 2021-5-8 10:52
看源码
[Python] 纯文本查看 复制代码
def strftime(format, p_tuple=None): # real signature unknown; restored from __doc__
    """
    strftime(format[, tuple]) -> string
    
    Convert a time tuple to a string according to a format specification.
    See the library reference manual for formatting codes. When the time tuple
    is not present, current time as returned by localtime() is used.
    

这句话的意思是,当时间元组(也就是第二个参数)不存在,则使用localtime()返回的当前时间。
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止回复与主题无关非技术内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-5-15 17:37

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表