[Tutor] Sorting

Daniel Yoo dyoo@hkn.EECS.Berkeley.EDU
Sun, 16 Jan 2000 14:04:15 -0800 (PST)


> Message: 4
> Date: Sat, 15 Jan 2000 21:15:57 -0600 (CST)
> From: Ben Beuchler <insyte@emt-p.org>
> To: Python Tutor <tutor@python.org>
> Subject: [Tutor] Sorting
> 
> Any good references on sorting techniques?  I don't have the programming
> background to be familiar with even the most basic algorithms...
> 
> To start with, I just need to be able to sort a file of about 150 or so
> lines based on different columns on each line...

The Art of Computer Programing (Vol 3: Searching and Sorting) is all about
sorting techniques.  It's one of the authoritative references.  If you
just want to sort a file, however, lists have a sorting routine.  On Page
48 of Learning Python:

L = ['eat, 'more', 'SPAM', 'please']
L.sort()
L

-> ['SPAM', 'eat', 'more', 'please']

and another example is on page 247 of Learning Python.