Re: Tabs, spaces, and indentation
Guido.van.Rossum@cwi.nl
Wed, 13 Apr 1994 14:00:18 +0200
> My suggestion is that if you move code from Unix to other platforms where
> mixing tabs and spaces might cause problems you run your code through a
> filter to convert tabs to the appropriate number of spaces. Emacs' untabify
> command does the trick nicely. There may well be other more traditional Unix
> filters available. (Gee, perhaps somebody has written something appropriate
> in Python...:-)
Good idea. The subroutine you need indeed exists in Python:
>>> import string
>>> string.expandtabs('abc\tdef\tghi\nxyz\tuvw\tpqr', 8)
'abc def ghi\012xyz uvw pqr'
>>>
so the script to apply this to a directory full of files should be
trivial :-)
--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
URL: <http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>