preface
Python has become one of the hottest programming languages of the moment, relying on big data, AI, artificial intelligence, etc.
So there are a lot of engineers learning Python these days. But in fact, for those of you who are code 0 based, there are still some mistakes that can be made when learning basic syntax.
So, this article will summarize, in the basic stage, make more mistakes.
Error: One equals sign (=) is an assignment, two equals signs (==) is a comparison
Error: not adding “:” (colon) at the end of control flow or function if, for, def
IndentationError: expected an indented block: code IndentationError
NameError: name ‘XXX’ is not defined: the XXX variable is not defined
List index out of range: The list is out of range.
KeyError: ‘XXX’ : takes a nonexistent key in the dictionary
TypeError: argument of type ‘int’ is not iterable: TypeError: argument of type ‘int’ is not iterable **
Reason: Not in is the member operator and cannot say that the number “1” is not inside the number “2”.
TypeError: XXX takes no arguments: a function constructed failed
Reason: Constructors are written __init__, not _init_, init with two underscores () on both sides, not one ()
Ps we need to be able to pay attention to the collection, easy to view oh ~