replacing multiple instances of commas beginning at specific position
striker at trip.net
Mon Nov 14 18:43:57 CET 2005
I have a comma delimited text file that has multiple instances of
multiple commas. Each file will contain approximatley 300 lines. For
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?
Any help would be greatly appreciated.
More information about the Python-list