Python中的ctime()方法使用教程
2015-05-22 11:57
656 查看
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中的ctime()方法使用教程
- 在Python中使用dict和set方法的教程
- 在Python中使用__slots__方法的详细教程
- Python类的定义、继承及类对象使用方法简明教程
- Python2.x版本中cmp()方法的使用教程
- Python中的ceil()方法使用教程
- Python中的ceil()方法使用教程
- Python2.x版本中cmp()方法的使用教程
- Python的randrange()方法使用教程
- Python的randrange()方法使用教程
- Python中的index()方法使用教程
- Python中的index()方法使用教程
- Python中List.index()方法的使用教程
- Python中List.count()方法的使用教程
- Python中zfill()方法的使用教程
- 在Python中使用swapCase()方法转换大小写的教程
- Python中使用strip()方法删除字符串中空格的教程
- Python中使用strip()方法删除字符串中空格的教程
- 在Python中使用swapCase()方法转换大小写的教程
- Python中zfill()方法的使用教程