Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
范围内的功能对我不起作用:
for x in range(0, 10): print str(x)
如果我想按两位数(或其他离散增量)怎么办?在 Java 或 C 中,这很简单,但在 Python 中,您还可以在每次循环迭代时设置计数器的增量吗?
range 函数将步长值作为第三个参数..
for x in range(0, 10, 2): print str(x)