码迷,mamicode.com
首页 > 其他好文 > 详细

List methods

时间:2014-07-13 19:16:32      阅读:236      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   http   2014   for   

Python provides methods that operate on lists. For example, append adds a new element to the end of a list, extend takes a list as an argument and appends all of the elements:

 bubuko.com,布布扣                      

And this example leaves t1 unmodified.

sort arranges the elements of the list from low to high:

 bubuko.com,布布扣

List methods are all void; they modify the list and return None. If you accidentally write t = t.sort(), you wiil be disappointed with the result.

 bubuko.com,布布扣

 

from Thinking in Python

List methods,布布扣,bubuko.com

List methods

标签:des   style   blog   http   2014   for   

原文地址:http://www.cnblogs.com/ryansunyu/p/3841119.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!