I\'m trying to write a python function not using any modules that will take a string that has tabs and replace the tabs with spaces appropriate for an inputted tabstop size.
Use the re.sub is enough.
def untabify(s, tabstop = 4): return re.sub(re.compile(r'\t'), ' '*tabstop, s)