more questions...(strings)

p.s me at home.com
Sun Feb 23 15:25:12 EST 2003


Hi again,
I've gotten some practice reading strings from files, and using raw_input,
and now I'm looking into splitting strings.
I know how to get something like "hello at there", split by doing
str.split("@"), and I get a list of ["hello", "there"].
However, I'm trying to get two lists, the first with the string before the
"@", and the second list with the remainder of the string.

So if i read from a file with:
one at two
white at black
left at right
I'd end up with this:
list_one = ["one", "white", "left"]
list_two = ["two", "black", "right"]

thanks for reading.
-p-




More information about the Python-list mailing list