python2 中 range返回列表,相当于python3的xrange
python3 中 range返回可迭代对象
#测试不同种形成list的效率
import timeit
def test1():
li = []
for i in range (10000):
li.append(i)
def test2():
li = []
for i in range (10000):
li += [i]
def test3():
li = [li for i in range(10000)]
def test4():
li = [li for i in range(10000)]