cognitive science
and more
Intro Bio Psy
Fix mixed tab/space indentation in Python code

In Python you can choose whether you want to indent your code using spaces or tabs. However, mixing the two can cause problems. Therefore, I made a simple Python script to fix mixed indentation.

Download: fixindent.

Let's say that you want to change all tab-indents to space-indents (4 spaces wide).

fixindent -i -s -w 4 -o

Or, conversely, change all space-indents (8 spaces wide) into tabs. You also want to clean-up extraneous white-space etc. from the line-endings (-c):

fixindent -i -t -w 8 -c -o

You can also use pipelines (under Linux at least):

cat | fixindent -t -c >