[Tutor] (no subject)
Annika Scheffler
annika.scheffler@gmx.net
Wed, 2 Oct 2002 10:48:25 +0200 (MEST)
Hi Rob,
Thanks for your help! In fact, it does work that way for me, too. But when
writing a function like this:
def sortList(someList):
return someList.sort()
print sortList("What have we here".split())
I get "none" as a result. Why's that?
Thanks,
Annika
Message: 3
From: "Rob" <rob@uselesspython.com>
To: "Python Tutor" <tutor@python.org>
Subject: RE: [Tutor] sort method
Date: 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 = "What have we here".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!