names = ('jiaozi','rice','zahui')
for name in names:
print(names[0])
print(names[1])
print(names[2])
我只想每个元素抽出来打印一次,但是上述程序每次都打印三次,运行结果如下。
jiaozi
rice
zahui
jiaozi
rice
zahui
jiaozi
rice
zahui
names = ('jiaozi','rice','zahui')
for name in names:
print(names[0])
print(names[1])
print(names[2])
我只想每个元素抽出来打印一次,但是上述程序每次都打印三次,运行结果如下。
jiaozi
rice
zahui
jiaozi
rice
zahui
jiaozi
rice
zahui
names = ('jiaozi','rice','zahui')
for name in names:
print(name)
或者
names = ('jiaozi','rice','zahui')
print(names[0])
print(names[1])
print(names[2])