Life is short, you need Python

摘要: List MethodsHere are some other common list methods.list.append(elem) -- adds a single element to the end of the list. Common error: does not return the new list, just modifies the original. list.insert(index, elem) -- inserts the element at the given index, shifting elements to the right. list.exte 阅读全文
posted @ 2011-04-26 17:03 runfox545 阅读(1944) 评论(0) 推荐(0)
摘要: sorted(...) sorted(iterable, cmp=None, key=None, reverse=False) --> new sorted listiterable:是可迭代类型;cmp:用于比较的函数,比较什么由key决定,有默认值,迭代集合中的一项;key:用列表元素的某个属性和函数进行作为关键字,有默认值,迭代集合中的一项;reverse:排序规则. reverse = True 或者 reverse = False,有默认值。返回值:是一个经过排序的可迭代类型,与iterable一样。refer to :http://wiki.python.org/moin/H 阅读全文
posted @ 2011-04-26 15:12 runfox545 阅读(1121) 评论(1) 推荐(0)
白月黑羽 Python教程 白月黑羽Python