python列表连接添加性能测试代码
L = [1, 2] L = L + [3] # concatenate: slower print L L.append(4) # faster, but in-place print L L = L + [5, 6] # concatenate: slower print L L.extend([7, 8]) # faster, but in-place print L L += [9, 10] # mapped to L.extend([9, 10]) print L