python中list函数_list()函数以及Python中的示例
python中list函數
Python list()函數 (Python list() function)
list() function is a library function, it is used to create a list, it accepts multiple elements enclosed within brackets (because list() takes only one argument. Thus, the set of elements within brackets is considered as a single argument).
list()函數是一個庫函數,用于創建列表,它接受括在方括號內的多個元素(因為list()僅接受一個參數,因此,括號內的元素集被視為單個參數)。
Syntax:
句法:
list((elements))Parameter(s): elements – list of the elements.
參數: 元素 – 元素列表。
Return value: list – it returns a list of given elements.
返回值: list –返回給定元素的列表。
Example:
例:
Input:students = list(("Amit shukla", "prem", "Radib", "Abhi"))Output:students: ['Amit shukla', 'prem', 'Radib', 'Abhi']Python code to create a list using list() function
使用list()函數創建列表的Python代碼
# python code to demonstrate example of # list() method # creating list students = list(("Amit shukla", "prem", "Radib", "Abhi"))# printing type of list() function print("type of list() function: ", type(students))# printing list... print("students: ", students)Output
輸出量
type of list() function: <class 'list'> students: ['Amit shukla', 'prem', 'Radib', 'Abhi']翻譯自: https://www.includehelp.com/python/list-function-with-example.aspx
python中list函數
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的python中list函数_list()函数以及Python中的示例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 带有Python示例的math.exp(
- 下一篇: 工程中多个不同类型线程池_软件工程中不同