I have these 3 strings:
YELLOW,SMALL,STRETCH,ADULT,T21fdsfdsfs
YELLOW,SMALL,STRETCH,ADULT,Tdsfs
YELLOW,SMALL,STRETCH,ADULT,TD
According to The Zen of Python:
There should be one-- and preferably only one --obvious way to do it.
...so here's a third, which uses rpartition:
>>> for item in catalogue:
... print item.rpartition(',')[0]
...
YELLOW,SMALL,STRETCH,ADULT
YELLOW,SMALL,STRETCH,ADULT
YELLOW,SMALL,STRETCH,ADULT
I haven't compared its performance against the previous two answers.