#coding=utf8
importcStringIOimportStringIOimporttime
values=[]
items= ['1,2,31,2,31,2,31,2,3'] * 10000000
#print items
st=float(time.time())for i initems:
values.append(i)
news= ''.join(values)printlen(news)print 'list append cost time:%s'%(float(time.time()) -st)
strio=cStringIO.StringIO()
st=float(time.time())for j initems:
strio.write(j)printlen(strio.getvalue())print 'cStringIO cost time:%s'%(float(time.time()) -st)
strio=StringIO.StringIO()
st=float(time.time())for j initems:
strio.write(j)printlen(strio.getvalue())print 'StringIO cost time:%s'%(float(time.time()) - st)