sort in the list

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Shi Mu

    #1

    sort in the list

    I use Python 2.3 to run the following code:[color=blue][color=green][color=darkred]
    >>> a=[[1,2],[4,8],[0,3]]
    >>> a.sort()
    >>> a[/color][/color][/color]
    [[0, 3], [1, 2], [4, 8]][color=blue][color=green][color=darkred]
    >>>[/color][/color][/color]
    I wonder whether the sort function automatically consider the first
    element in the list of list as the sorting criteria or it just happens
    to be?
    Thanks!
Working...