Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
284 views
in Technique[技术] by (71.8m points)

python - Python整数递增与++ [重复](Python integer incrementing with ++ [duplicate])

Possible Duplicate:

(可能重复:)
Python: Behaviour of increment and decrement operators

(Python:增量和减量运算符的行为)

I've always laughed to myself when I've looked back at my VB6 days and thought, "What modern language doesn't allow incrementing with double plus signs?":

(当我回顾我的VB6时,我总是嘲笑自己,并且想:“现代语言不允许用双加号增加?”:)

number++

To my surprise, I can't find anything about this in the Python docs.

(令我惊讶的是,我在Python文档中找不到任何相关内容。)

Must I really subject myself to number = number + 1 ?

(我真的必须让自己受到number = number + 1吗?)

Don't people use the ++/-- notation?

(人们不使用++/--符号吗?)

  ask by Znarkus translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Python不支持++ ,但您可以这样做:

number += 1

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...