Regular Expressions and Dividing Strings

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

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


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 :)


My blog:
My homepage:

"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