I’m so sick of Django. I wrote a Python Function which is working correct.
For reasons of visualizations I decided to make a web-page to demonstrate my function.
I added some code to my function:
txt_len = 0 (line 1)
if text:
txt_len=len(text)
return txt_len
*it’s only a example.
But for a reason I get an IndentationError ,unexpected indent at line 1
Why? can’t get it.
Let’s see the whole function? Line 1 is just for example right? Line 1 would at the very least have to be a function definition for that return line to work.
Did you just paste a function into a django view?
The culprit for mystery indentation errors is almost always mixing spaces and tabs. Do you have invisible characters visible in your editor? Can you run a command to replace tabs with spaces?