热线电话:13121318867

登录
2019-06-25 阅读量: 430
如何使用列表创建空值

使用列表:列表就像使用方括号创建的项目数组。它们与数组不同,因为它们可以包含不同类型的项目。列表与元组不同,因为它们是可变的。

# A Python program to to return multiple

# values from a method using list

# This function returns a list

def fun():

str = "geeksforgeeks"

x = 20

return [str, x];

# Driver code to test above method

list = fun()

print(list)

输出:

['geeksforgeeks',20]
43.5548
4
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子