2019-06-25
阅读量:
504
如何使用字典返回多个值?
使用词典:词典类似于其他语言中的哈希或地图。可以
# A Python program to to return multiple
# values from a method using dictionary
# This function returns a dictionary
def fun():
d = dict();
d['str'] = "GeeksforGeeks"
d['x'] = 20
return d
# Driver code to test above method
d = fun()
print(d)
输出:
{'x':20,'str':'GeeksforGeeks'}






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论