splitting strings into variables
Dave Reed
dreed at capital.edu
Mon Apr 14 19:52:57 EDT 2003
On Monday 14 April 2003 19:33, lost wrote:
> hi there,
> i've read about splitting strings, and can do
> strname.split(delimeter)
> but what i need is something like this:
> strname = hello:there
> strname.split(":")
> print strname
> hello
>
> so :there is taken away, and i just have hello? how can i do that
with
> split?
strname = "hello:there" # your example was missing quotes here
strname = strname.split(":")[0]
print strname
hello
Dave
More information about the Python-list
mailing list