range()函数优化

range()函数,根据起始值,终止值及步进值3个参数在内存中建立列表,当需要一个很大的列表时,这种方式即占内存又费时间

优化方式:
python提供了xrange()
>>> for i in xrange(10000): #python 2.x系列可以使用xrange(),3.x系列中使用range()
print(“test for xrange ,run %d” %i)
3.x系列中使用range()
>>> for i in range(10000):
print(“test for range ,run %d” %i)
zp8497586rq

But as always, apple does a really good job of taking a concept that has existed for years, mass marketing the hell out of it, and convincing consumers that it’s something apple came up with The weekly hosts invite paper writers using http://paper-writer.org/ a few powerful conversationalists from the week’s chat to reflect and share

标签:
本文连接地址: http://www.fresker.com/archives/493 (转载注明出处)

回复

目前暂无评论

Sorry, 评论已关闭.