Chinaunix首页 | 论坛 | 博客
  • 博客访问: 61847
  • 博文数量: 18
  • 博客积分: 1400
  • 博客等级: 上尉
  • 技术积分: 210
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-26 16:04
文章分类

全部博文(18)

文章存档

2011年(1)

2009年(3)

2008年(14)

我的朋友

分类: Python/Ruby

2008-11-13 10:58:23


src = "2008-11-12 10:33:33"

temp = mktime(re.split("[ :-]",src).extend("000"))
print "temp:",temp


#re.split("[ :-]",src)是将空格,冒号和横杠作为分隔符,将src按年月日时分秒分为六

#项, extend("000")填上三项,每一项都是0,因为满足mktime()的需要(需要9项),然后

#就将src转换为秒数了

阅读(5281) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

zpp712008-11-26 00:03:32

>>> from time import * >>> import re >>> src = "2008-11-12 10:33:33" >>> temp = mktime(re.split("[ :-]",src).extend("000")) Traceback (most recent call last): File "", line 1, in TypeError: argument must be 9-item sequence, not None 验证过没?