Tim Chase wrote: > Norman Khine wrote: > > Hello, > > I have a csv file which is has a field that has something like: > > > > text.csv > > "text (xxx)" > > "text (text) (yyy)" > > "text (text) (text) (zzz)" > > > > I would like to split the last '(text)' out and put it in a new column, > > so that I get: > > > > new_test.csv > > "text","(xxx)" > > "text (text)","(yyy)" > > "text (text) (text)","(zzz)" > > > > how can this be done? > > line.rsplit(None, 1) > > seems to do the trick for me: >
provided the (xxx) etc doesn't contain whitespace. -- http://mail.python.org/mailman/listinfo/python-list