RB[0] wrote:
Yeah, if you want to convert just the tabs at the start of a line, you would need to do:print open("myfile.py").read().replace("\n"+" "*4, "\t")
No, that only replaces the first group of 4 spaces on each line, and removes the newlines as well. The obvious way to do this properly is to loop over the lines and use the expandtabs() string method. -- Greg