Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


We have a million ounces of prevention when it comes to mixing tabs and spaces in a python file, from tabnanny to pylint to "-tt" to simply being familiar with your editor configuration.

But, in the unfortunate case where you inherit a tainted file, there is no cure. You can run "tabify" in emacs, but that just replaces tabs with a set number of spaces. If you're familiar with the errors that can result from sloppy tabbing, you know it's not as simple as all that. In fact,

First, tabs are replaced (from left to right) by one to eight spaces such that the total number of characters up to and including the replacement is a multiple of eight (this is intended to be the same rule as used by Unix).

(source: ) is your pound of cure.

Usage is a simple python script that interprets tabs according to the language spec mentioned above. It's so simple that it takes stdin and sends to stdout:

cat | python >

And that's all there is to it.

Limitations does not perform any prettification or other reformatting aside from the tab interpretation described in the Python language spec. In other words, it won't make the code pretty, readable, or even correct. Instead, it gives you the code, indented as python sees it, bereft of the terrible plague named "tab".


python script to convert tabs to spaces in source files, per the python language spec




No releases published


No packages published


You can’t perform that action at this time.