OriginalBrownster wrote: > Hi there: > > I was wondering if its at all possible to search through a string for a > specific character. > > I want to search through a string backwords and find the last > period/comma, then take everything after that period/comma > > Example > > If i had a list: bread, butter, milk > > I want to just take that last entry of milk. However the need for it > arises from something more complicated. > > Any help would be appreciated >
Would that work for you ? >>> a = 'bread, butter, milk' >>> a 'bread, butter, milk' >>> b = a.split(',') >>> b ['bread', ' butter', ' milk'] >>> c = b[-1] >>> c ' milk' >>> d = c.strip() >>> d 'milk' HIH Avell -- http://mail.python.org/mailman/listinfo/python-list