🍒for in
for item in iterable:
dosomething
item :元素
iterable :集合
something :循环处理语句
例:
for t in 'love':
print(t+'-')
![](https://i-blog.csdnimg.cn/blog_migrate/0259ce984c0503744ba46ddff81fcc18.png)
运行结果为:
D:\WJ\py\pythonProject\venv1\Scripts\python.exe D:\WJ\py\pythonProject\语句\循环语句.py
l-
o-
v-
e-
Process finished with exit code 0
![](https://i-blog.csdnimg.cn/blog_migrate/61580db46461d22e3225a4aad15b2562.png)
意为将love中的每一个字母分别赋值给t,然后分别打印出来