Home python Why is there an IndentationError: unexpected indent error?

Why is there an IndentationError: unexpected indent error?




Installed python under Windows 10 64bit. Powered by Anaconda. Python 3.4 environment. Installed theano.

import theano works on line by line input to the console.
When I try to run any file with an example, there is no connection with theano.

 enter image description here

Answer 1, authority 100%

If you translated the error text, you would realize that you have a problem with indentation.
Note the indentation before import .

As a reminder, in python, code blocks are indented.

If python thinks that your code nesting is indicated by four
spaces, namely this line is broken off with one tab, then it will be like this

Based on this answer.

In this case, the indentation should be removed altogether.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions