美文网首页
初入Python25/100

初入Python25/100

作者: 华域说说 | 来源:发表于2017-07-04 06:51 被阅读11次

插入时间模块

打印出了年,月,日,时,分,秒

time.time()

返回值

返回当前时间的时间戳(1970纪元后经过的浮点秒数)。

实例

以下实例展示了 time() 函数的使用方法:

#!/usr/bin/pythonimporttimeprint"time.time(): %f "%time.time()printtime.localtime(time.time())printtime.asctime(time.localtime(time.time()))

以上实例输出结果为:

time.time():1234892919.655932(2009,2,17,10,48,39,1,48,0)TueFeb1710:48:392009

localtime()Python time localtime()方法

描述

Python time localtime() 函数类似gmtime(),作用是格式化时间戳为本地的时间。 如果sec参数未输入,则以当前时间为转换标准。 DST (Daylight Savings Time) flag (-1, 0 or 1) 是否是夏令时。

asctime()Python time asctime()方法

描述

Python time asctime() 函数接受时间元组并返回一个可读的形式为"Tue Dec 11 18:07:14 2008"(2008年12月11日 周二18时07分14秒)的24个字符的字符串。

相关文章

  • 初入Python25/100

    插入时间模块 打印出了年,月,日,时,分,秒 time.time() 返回值 返回当前时间的时间戳(1970纪元后...

  • Python25

  • 初入Python01/100

    Python大大开始带入门。 初次看打码。 看少了2处,花了几分钟一行一行看,找到了四和五行打漏了,还有key少了...

  • 初入Python15/100

    新的在线工具 http://rextester.com/l/python_online_compiler 自己上图...

  • 初入Python14/100

    新的在线工具https://c.runoob.com/compile/6?from=groupmessage 大大...

  • 初入Python04/100

    直接上图 大大的 我这次很耐心。自己检查。结果是一个错误。rang后面少了个e.羞羞。 手边暂时没有电脑的战友可戳...

  • 初入Python17/100

    上图 总结:找找错的,第九行,少了一个1. 今天是介绍字符串的替换和查找 replace在say1用Hello换了...

  • 初入Python18/100

    大大:周六日的周末作业 今天的007挑战,一个线人需要在某天的某点某地约007碰面,但这个情报又必须在公开场合里传...

  • 初入Python31/100

    还好群里有人问。不然我半天都打不出来,把第9.10提到6行后。

  • 初入Python34/100

    自己的 好的

网友评论

      本文标题:初入Python25/100

      本文链接:https://www.haomeiwen.com/subject/dirthxtx.html