astr = 'hello'
alist = [10,20,30]
atuple = ('bob','tom','alice')
adict = {'name':'john','age':23}

for ch in astr:
print(ch)

for i in alist:
print(i)

for name in atuple:
print(name)

for key in adict:
print('%s: %s' %(key,adict[key]))

结果输出:

 23-for循环遍历数据对象 随笔

 

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。
扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄