Regular Expressions and Dividing Strings

James Colannino james at colannino.org
Tue Nov 8 23:59:35 CET 2005


Hey everyone, I have a file containing the following type of data (only 
an example):

root:root

What I want to do is take this line and divide it into two separate 
strings (the ':' character would divide the two strings, so the result 
of the example above would be "root" and "root.")  The names will vary 
in length (this refers to username/group ownerships.)  I'm probably 
missing something extremely basic.  I found the module re to do the 
regular expression matching I need, but I'm not quite sure how I can 
actually split this line up into two separate variables.

Thanks in advance :)

James

-- 
My blog: http://www.crazydrclaw.com/
My homepage: http://james.colannino.org/

"A well regulated militia being necessary to the security of a free
state, THE RIGHT of the people to keep and bear arms SHALL NOT BE
INFRINGED." --United States Constitution, Second Ammendment




More information about the Python-list mailing list