Reputation: 9
beginning to learn python, so sorry if this is elementary. Why is the error "Expected::" calls by this code:
cur.execute('''SELECT error FROM WT_enercon_bawnmore WHERE error <> 0;''')
count = 0
for key in d:
for i in cur:
if key = i:
count += 1
d[key] = count
Eclipse is indicating that the fifth line is the route of the problem. Thanks in advance.
Upvotes: 0
Views: 35206
Reputation: 11
The error you're getting is stating that it expected to get an expression it could evaluate. Instead it sees that you are trying to make a variable assignment in your if
statement.
key = i # assign i to key
key == i # evaluate equality of i and key
An if
statement expects something that can be evaluated to either True
or False
, like key == i
.
Upvotes: 1
Reputation: 12448
When programming in Python, you use '='
to assign values to the variable, if you want to compare you have to use '=='
Upvotes: 2