striker wrote: > I have a comma delimited text file that has multiple instances of > multiple commas. Each file will contain approximatley 300 lines. For > example: > > one, two, three,,,,four,five,,,,six > one, two, three,four,,,,,,,,,,eighteen, and so on. > > There is one time when multiple commas are allowed. Just prior to the > letters ADMNSRC there should be one instance of 4 commas. ( > ,eight,,,,ADMNSRC,thirteen, ). The text ADMNSRC is NOT in the same > place on each line. > > What would be the best approach to replace all instances of multiple > commas with just one comma, except for the 4 commas prior to ADMNSRC?
Seems like a typical use case for the re module... -> now you've got *2* problems- !-) -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list