python 3 中的time模块使用(待完善)
来源:互联网 发布:linux查看jdk版本 编辑:程序博客网 时间:2024/06/05 09:46
python中和时间处理有关的模块包括time,datetime,calender等模块:
python通常用这几种方式来表示时间:1)时间戳,2)格式化的字符串,3)元祖struct_time中含有九个元素,分别表示的就是年月日等信息time模块中包含的某些函数:
time.localtime([secs]): 将一个时间戳转换为当前时区的struct_time。secs参数未提供,则以当前时间为准。
time.gmtime([secs]): 和localtime()方法类似,gmtime()方法是将一个时间戳转换为UTC时区(0时区)的struct_time。
time.time():返回当前时间的时间戳。
time.mktime(t):将一个struct_time转化为时间戳。
time.sleep(secs):线程推迟指定的时间运行。单位为秒。
time.clock():第一次运行的时候表示程序运行到现在所用的时间,以后每次调用的话就是指第一次调用之后到现在的所用的运行时间
time.asctime([t]):把一个表示时间的元组或者struct_time表示为这种形式:'Sun Jun 20 23:21:05 1993'。如果没有参数,将会将time.localtime()作为参数传入。
time.ctime([secs]):把一个时间戳(按秒计算的浮点数)转化为time.asctime()的形式。如果参数未给或者为None的时候,将会默认time.time()为参数。它的作用相当于time.asctime(time.localtime(secs))。
time.strftime(format[, t]):把一个代表时间的元组或者struct_time(如由time.localtime()和time.gmtime()返回)转化为格式化的时间字符串。如果t未指定,将传入time.localtime(),如果元组中任何一个元素越界,ValueError的错误将会被抛出。
- python 3 中的time模块使用(待完善)
- python中的time模块
- (转)python中的time模块
- Python待完善
- c++中的流操作(待完善)
- Python中的time模块介绍
- python中的计时模块:time.time()
- Android动画使用总结(待完善)
- httpclient使用,待完善
- curl使用(待完善)
- Android_Vitamio使用(待完善)
- Python and time模块使用
- python的time模块使用
- python time模块使用实例
- python小练习(待完善)
- 闲杂(待完善)
- EditText(待完善)
- TextView(待完善)
- Apt和dpkg快速参考
- 作用域、上下文、闭包、原型、继承
- React的componentWillUpdate获取不到更新的props值(redux)
- 计算几何-离散化
- How to install compiz
- python 3 中的time模块使用(待完善)
- Harris 角点检测
- 解决mac上matplotlib(plot)无法显示中文的问题 (Python)
- Java 数据类型转换
- java基础三:Arraylist和LinkList区别
- 先后出现Requested setting DEFAULT_INDEX_TABLESPACE和No module named
- Fence Repair POJ
- Programming Clojure.pdf 英文原版 免费下载
- 647. Palindromic Substrings