小白教程
所有教程
关于
Search
172.71.254.239
172.71.254.239
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Python3 att list list”的源代码
本页内容
上一节:
Python_func_frozenset
下一节:
Python3_func_range
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:list()}}[[Category:python3 built in functions|47]] = Python3 List list()方法 = [[python3 list|Python3 列表]] == 描述 == list() 方法用于将元组或字符串转换为列表。 '''注:'''元组与列表是非常类似的,区别在于元组的元素值不能修改,元组是放在括号中,列表是放于方括号中。 == 语法 == list()方法语法: <sample title="" desc="" lang="python" hererun="1"> list( seq ) </sample> == 参数 == * seq -- 要转换为列表的元组或字符串。 == 返回值 == 返回列表。 以下实例展示了 list()函数的使用方法: <sample title="" desc="" lang="python" hererun="1"> #!/usr/bin/python3 aTuple = (123, 'Google', 'xiaoBai', 'Taobao') list1 = list(aTuple) print ("列表元素 : ", list1) str="Hello World" list2=list(str) print ("列表元素 : ", list2) </sample> 以上实例输出结果如下: <sample title="" desc="" lang="python" hererun="1"> 列表元素 : [123, 'Google', 'xiaoBai', 'Taobao'] 列表元素 : ['H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd'] </sample> [[python3 list|Python3 列表]]
返回至“
Python3 att list list
”。
上一节:
Python_func_frozenset
下一节:
Python3_func_range