Python中的ctime()方法使用教程,pythonctime
Python中的ctime()方法使用教程,pythonctime
ctime()方法转换,因为历元到表示本地时间的字符串表示以秒为单位的时间。如果不设置秒时或None,所返回的时间的当前time()被使用。使用asctime(localtime(secs))。不使用ctime()的区域信息。
语法
以下是ctime()方法的语法:
time.ctime([ sec ])
参数
- sec -- 这些都是秒数要被转换成字符串表示。
返回值
此方法不返回任何值。
例子
下面的例子显示了ctime()方法的使用。
#!/usr/bin/python import time print "time.ctime() : %s" % time.ctime()
当我们运行上面的程序,它会产生以下结果:
time.ctime() : Tue Feb 17 10:00:18 2014
相关内容
- 在Python中操作日期和时间之gmtime()方法的使用,pythong
- Python中的localtime()方法使用详解,pythonlocaltime
- 在Python中操作时间之mktime()方法的使用教程,pythonmkti
- Python3读取UTF-8文件及统计文件行数的方法,
- Python3处理文件中每个词的方法,
- python实现数组插入新元素的方法,python新元素
- python实现的简单抽奖系统实例,python抽奖实例
- linux下python抓屏实现方法,python抓屏
- python使用reportlab实现图片转换成pdf的方法,
- Python中用sleep()方法操作时间的教程,pythonsleep
评论关闭