how to "normalize" indentation sources

AndyL ask at me
Thu May 25 04:42:37 CEST 2006


John Machin wrote:
> On 25/05/2006 12:00 PM, AndyL wrote:
> 
>> Hi,
>>
>> I have a lot of sources with mixed indentation typically 2 or 4 or 8 
>> spaces. Is there any way to automatically convert them in let's say 4 
>> spaces?
>>
> 
> Yup. Right under your nose:
> 
> C:\junk>\python24\tools\scripts\reindent.py --help
> reindent [-d][-r][-v] [ path ... ]
> 
> -d (--dryrun)  Dry run.  Analyze, but don't make any changes to, files.
> -r (--recurse) Recurse.  Search for all .py files in subdirectories too.
> -v (--verbose) Verbose.  Print informative msgs; else no output.
> -h (--help)    Help.     Print this usage information and exit.
> 
> Change Python (.py) files to use 4-space indents and no hard tab 
> characters.
> Also trim excess spaces and tabs from ends of lines, and remove empty lines
> at the end of files.  Also ensure the last line ends with a newline.
> [snip]
> 
> 
thx a lot, A.



More information about the Python-list mailing list