python 3.x - How to replace multiple tabs with only one tab using
https://stackoverflow.com/questions/64092492/how-to-replace-multiple-tabs-with-only-one-tab-using-python3-pandas-in-a-given
WebSep 27, 2020 · So, you can use regex to substitute consecutive \t instances. You still need to provide more details, but take this as a provisional answer. import re. with open('test.csv', 'r') as fo: text = fo.read() print(text) print(repr(text)) text = re.sub(r'\t+', r'\t', text) print(text)
DA: 74 PA: 56 MOZ Rank: 31