遍历字典
for key, value in content.items():
print(key, value)
遍历列表
for value in content:
print(value)
遍历元组
t=(('name','lim','aaaaa'),('sex','girl','bbbbb'),('job','da','cccccc'))
for value in t:
print(value)
for value2 in value:
print(value2)
print("==")
print("==============")
for in 用法
二元用法(输出0~9的10个数字):
for i in range(10):
print(i)
三元用法:
[x.upper() for x in 'abcde']
Out[7]: ['A', 'B', 'C', 'D', 'E']
四元用法:
[x.upper() for x in 'abcaade' if x=='a']
Out[8]: ['A', 'A', 'A']
python使用for遍历字典、列表和字符串的几种方法 http://blog.ganyongmeng.com/?p=860
python的for in 三元,四元用法 https://blog.csdn.net/weixin_43860294/article/details/104788555