python(18):遍历、公共方法、引用、可变与不可变类型

1、遍历 经过for ... in ...:的语法结构,咱们能够遍历字符串、列表、元组、字典等数据结构。python 1.字符串遍历 >>> a_str = "hello itcast" >>> for char in a_str: ...     print(char,end=' ') ... h e l l o   i t c a s t   2.列表遍历 >>> a_list = [1, 2
相关文章
相关标签/搜索