浙江省高等学校教师教育理论培训

微信搜索“毛凌志岗前心得”小程序

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
#! /usr/bin/env python
#coding=utf-8
import pickle
import cPickle
#6.6M
def searlize_to_txt():
    f=open("searlize.txt","w")
    for i in xrange(1,1000000):
        f.write("%s\n"%i)
    f.close()
    print "done!"
#8.5M    
def searlize_to_binary():
    list=[i for i in xrange(1,1000000)]
    pickle.dump(list,open("searlize.bin","w"))
    
#8.5M
def searlize_to_binary2():
    list=[i for i in xrange(1,1000000)]
    cPickle.dump(list,open("searlize2.bin","w"))
if __name__ == '__main__':
    searlize_to_binary2()
    #searlize_to_binary()
    #searlize_to_txt()
posted on 2011-12-18 17:08  lexus  阅读(378)  评论(0编辑  收藏  举报