[Tutor] sort method

Rob rob@uselesspython.com
Tue, 1 Oct 2002 11:39:36 -0500


>>> l = "what have we here".split()
>>> l
['what', 'have', 'we', 'here']
>>> l.sort()
>>> l
['have', 'here', 'we', 'what']
>>>

Works for me.

Rob

> -----Original Message-----
> From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
> Annika Scheffler
> Sent: Tuesday, October 01, 2002 11:24 AM
> To: tutor@python.org
> Subject: [Tutor] sort method
>
>
> Hi,
>
> I am quite new to Python and I need your help:
>
> Can you give me a very simple example of the list.sort method?
> For instance I would like to sort this list:
>
> l = "We all place a great deal of reliance on the Theory and Practice of
> science, but the hopeful intentions of so many inventions can be
> quite buggered
> up in appliance.".split()
>
> How do I use the sort method?
>
> If I simply write l.sort() , it doesn't work...what do I need to add?
>
> Thanks a lot,
> Annika
>
>
>
> --
> Ravens fly in flights, but the egale flies
> alone.
>
> +++ GMX - Mail, Messaging & more  http://www.gmx.net +++
> NEU: Mit GMX ins Internet. Günstige DSL- & Modem/ISDN-Tarife!
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>