一、遍历 通过for。。。in。。。的语法结构,我们可以遍历字符串、列表、元组、字典等数据结构。 1、字符串遍历 a_str = “hello world” for char in a_str: print(char,end=’ ‘) 2、列表遍历 a_list = [1,2,3,4,5] for num in a_list: print(num,end=’ ‘) 3、元组遍历 a_tuple =(1,2,3,4,5) for num in a_tuple: print(num,end=’ ‘) 4、字典遍历 1)遍历字典的key dict = {‘name’:’zhansh