摘要: #-*- coding:utf-8 -*- from datetime import datetime #获取当前日期和时间 now =datetime.now() print now # 2017-08-10 16:41:57.437000 print (type(now)) # # 获取指定日期和时间 dt=datetime(2015,4,19,12,20) #用指定日... 阅读全文
posted @ 2017-08-11 15:34 记忆残留 阅读(183) 评论(0) 推荐(0) 编辑
摘要: # -*-coding:utf-8 -*- from collections import namedtuple Point=namedtuple('Point',['x','y']) p=Point(1,2) print p.x #1 print p.y #2 # namedtuple是一个函数,它用来创建一个自定义的tuple对象,并且规定了tuple元素的个数,并可以用属性而... 阅读全文
posted @ 2017-08-11 15:32 记忆残留 阅读(181) 评论(0) 推荐(0) 编辑