breaking a string

Emile van Sebille emile at fenx.com
Tue Oct 16 17:12:13 EDT 2001


Depending on the version of python, use
string.split("Hello World!"[:-1])
or
"Hello World!"[:-1].split()

--

Emile van Sebille
emile at fenx.com

---------
"Michael Yuen" <myuen at acs2.acs.ucalgary.ca> wrote in message
news:9qi6uu$h4c$1 at nserve1.acs.ucalgary.ca...
> I'm pretty new to this Python stuff and i'm trying to figure out how to
> break a string into it's component parts.
>
> For example, if a line of text in a file is:
> "Hello World!"
>
> I want to enter that into my list as just ['Hello', 'World']
> Can someone help me out?
>
> Thanks,
> M
>
> --




More information about the Python-list mailing list