Python List list()方法

Python 教程 · 2019-02-02 20:58:09

描述

list() 方法用于将元组转换为列表。

注:元组与列表是非常类似的,区别在于元组的元素值不能修改,元组是放在括号中,列表是放于方括号中。

语法

list()方法语法:

list( tup )

参数

  • tup -- 要转换为列表的元组。

返回值

返回列表。

实例

以下实例展示了 list()函数的使用方法:

#!/usr/bin/python # -*- coding: UTF-8 -*- aTuple = (123, 'xyz', 'zara', 'abc'); aList = list(aTuple) print "列表元素 : ", aList

以上实例输出结果如下:

列表元素 :  [123, 'xyz', 'zara', 'abc']

点击查看所有 Python 教程 文章: https://codercto.com/courses/l/8.html

查看所有标签

Web Design in a Nutshell

Web Design in a Nutshell

Jennifer Niederst / O'Reilly Media, Inc. / 2006-02-21 / USD 34.99

Are you still designing web sites like it's 1999? If so, you're in for a surprise. Since the last edition of this book appeared five years ago, there has been a major climate change with regard to web......一起来看看 《Web Design in a Nutshell》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

SHA 加密
SHA 加密

SHA 加密工具

html转js在线工具
html转js在线工具

html转js在线工具