I'm working with a file using commas as a delimiter. However, it has a field, address in it where the address is of form x,y,z which causes a problem as each part of the address gets a new column entry. The address is immediately followed by member_no a 1 digit number like 2 etc. Col1 (Address), Col2(1 Digit number)
text = '52A, XYZ Street, ABC District, 2'
I basically want to remove all commas before that number from the address field.
The output should be like
52A XYZ Street ABC District, 2'
I tried
re.sub(r',', ' ', text)
but it's replacing all instances of commas.