python的list()函數


list()函數將其它序列轉換為 列表 (就是js的數組)。 該函數不會改變   其它序列

    效果圖一:

    代碼一:

# 定義一個元組序列
tuple_one = (123,'456','abc')
print(tuple_one,type(tuple_one))
# 轉換並賦值給變量 a
a = list(tuple_one)
# 輸出 a , a的類型
print(a,type(a))

    效果圖二:

    代碼二:

list_one = [1,2,3,4,5,6,7,8,9,10]

r = filter(lambda i : i > 5 , list_one)
print(r,type(r))
t = list(r)
print(t,type(t))

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM