I\'m trying to create an application in Python 3.2 and I use tabs all the time for indentation, but even the editor changes some of them into spaces and then print out \"inc
I had the same problem and fix it using following python script. hope it help others.
it is because of using tabs and spaces for indenting code. in this script I replace each tab with four spaces.
input_file = "source code path here" # e.g. source.py
output_file = "out put file path here" # e.g out.py
with open(input_file, 'r') as source:
with open(output_file, 'a+') as result:
for line in source:
line = line.replace('\t', ' ')
result.write(line)
if you use sublime or any other editor which gives you the tool to replace text you can replace all tabs by four spaces from editor.