range(start, stop[, step])
# 从 0 开始到 9
>>>range(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
# 从 1 开始到 10
>>> range(1, 11)
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# 步长为 5
>>> range(0, 30, 5)
[0, 5, 10, 15, 20, 25]
# 步长为 3
>>> range(0, 10, 3)
[0, 3, 6, 9]
# 负数
>>> range(0, -10, -1)
[0, -1, -2, -3, -4, -5, -6, -7, -8, -9]
>>> range(0)
[]
>>> range(1, 0)
[]
name = "dzm"
for i in range(len(name)):
print(name[i])
# 输出:
d
z
m