Goodspeed

导航

2011年11月8日 #

Python中序列化处理之——marshal和cPickle篇

摘要: #!/usr/bin/python#coding=utf-8import osimport marshal,cPickle"""marshal只能序列化有限的类型而cPickle能够序列化自定义的类型"""class Foo: def __init__(self, name): self.name = name def __str__(self): return self.nameo=range(0,10)L = Foo("Goodspeed")cls = [marshal,cPickle]for c in cls 阅读全文

posted @ 2011-11-08 14:51 Goodspeed 阅读(1208) 评论(0) 推荐(0) 编辑

Python中时间的处理之——calendar篇

摘要: #! /usr/bin/python# coding=utf-8import calendar"""返回的某个月的日历返回类型是字符串型"""cal = calendar.month(2011, 11)"""返回一年的日历"""cal = calendar.calendar(2011)cal = calendar.HTMLCalendar(calendar.MONDAY)"""打印出一个月日历"""cal.forma 阅读全文

posted @ 2011-11-08 10:38 Goodspeed 阅读(5225) 评论(0) 推荐(0) 编辑