On 2013-02-15 18:04, Steve Goodwin wrote: > Hi, > > I am looking for the python2.7 function(s) to parse a string from a > colon character ":" > > Sounds simple enough. > > For example, a string like "123456:789". I just need the "123456" > substring.(left of the :) > > I have looked at regular expressions and string functions, so far > no luck. Custom function required?
With just a single character, it sounds like you want something like whole = "123456:789" parts = whole.split(':') # or .split(':', 1) interesting = parts[0] No custom function needed. -tkc -- http://mail.python.org/mailman/listinfo/python-list