breaking a string

Cliff Wells logiplexsoftware at earthlink.net
Tue Oct 16 17:15:43 EDT 2001


On Tuesday 16 October 2001 13:57, Michael Yuen wrote:
> 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
>
> --

line = "hello,world"
print line.split(" ")

-- 
Cliff Wells
Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308
(800) 735-0555 x308




More information about the Python-list mailing list