How to sort this kind of list easily?

BruceKL WhoH BruceWhoHKL at gawab.com
Fri Aug 20 05:03:51 EDT 2004


Hi,all
     I have a list like [(id,string),...],for example:

     [(1,'xxxxx'),(7,'ppppp'),(4,'gggggg'),...]

	 I want to sort this list according to the id of each element. After sorting,the list will become:

     [(1,'xxxxx'),(4,'gggggg'),(7,'ppppp')...]

     Is there any library for such things, Just like STL for C++? I just want to find a convenient way to do things like this.
		

        BruceKL WhoH
        BruceWhoHKL at gawab.com
          2004-08-20


More information about the Python-list mailing list