admin
admin
3310 1 0

python不同方法倒转一个list 的效率对比

ol = [1, 2, 3]; nl = ol[::-1]; 0.569 usec per loop
ol = [1, 2, 3]; nl = list(ol); nl.reverse();  0.686 usec per loop
ol = [1, 2, 3]; nl = [i for i in reversed(ol)];  1.48 usec per loop
ol = [1, 2, 3]; nl = list(reversed(ol)); 2.34 usec per loop
0

See Also

Nearby


Discussion (1)

php网站设计
php网站设计 2013-12-09 07:30

“ 你的代码”

0
Login Topics