问题描述:

This question already has an answer here:

  • Behaviour of increment and decrement operators in Python

    6 answers

网友答案:

There is no ++ operator in python. You must use

i += 1
网友答案:

It's just that i++ isn't supported in python. Replace that loop as follows:

i=0
while i<10:
   print i
   i += 1 # add 1 to i.

Or, even better (in case you are indeed using loops that way):

for i in range(0, 10):
    print i

Please take a look here for a list of all operators.

相关阅读:
Top