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. It can't just replace all size-n tabs by n spaces though, since a tab could be 1 to n spaces. I'm really confused, so if anyone could just point me in the right direction I'd greatly appreciate it.
For instance, if tabstop is size 4 originally:
123\t123 = 123 123 #one space in between
but changed to tabstop 5:
123\t123 = 123 123 #two spaces in between
I think I need to pad the end of the string with spaces until string%n==0 and then chunk it, but I'm pretty lost at the moment..
\t
which is one character and is always size 1. Do you want to replace spaces with tabs, maybe? Or spaces with fewer spaces? – Prady