Python 学习笔记 列表 for 循环 xxx XXX
print("-" * 30)
magicians = ['alice', 'david', 'carolina']
for magician in magicians:
print(magician)
for magician in magicians:
print(magician.title() + ", that was a great trick!")
print("I can't wait to see your next trick, " + magician.title() + ".\n")
print("Thank you, everyone. That was a great maigc show!")
print("-" * 30)
xjjl = ['bl', 'hrb', 'bj']
for c in xjjl:
print("wh: {}".format(c))

本文通过具体实例演示了Python中for循环的基本用法,包括遍历列表并打印元素,以及对每个元素进行操作。通过两个例子,展示了如何使用for循环处理不同类型的列表数据。
277

被折叠的 条评论
为什么被折叠?



