python has forced indent. A lot of the time you will seee the error because of indent or space. So it is very necessary to make the all the code indented by space or tab. This is how to replace tab by space or replace spaces by tab in linux.
1. replace space by tab
in bash you can run
sed -e 's/ /\t/g' test.py > test.new.py
in vim you can do this:
# first in .vimrc set up
:set expandtab
:set tabstop=4
# or you can do this
:set tabstop=4 shiftwidth=4 expandtab
# then in the py file in command mode, run
:retab!
or run this in command line
:set noet|retab!
2. replace tab to spaces
set option expandtab
(abbreviated to et
)
:set et|retab