标题:函数调用打印结果不完全
取消只看楼主
aa2820981
Rank: 1
等 级:新手上路
帖 子:28
专家分:0
注 册:2019-7-16
结帖率:100%
已结贴  问题点数:20 回复次数:1 
函数调用打印结果不完全
代码如下:
# -*-coding:gb2312 -*-
def build_carinfo(brand,name,**car_info):
    profile= {}
    profile['brand_name'] = brand
    profile['car_name'] = name
    for key,value in car_info.items():
        profile[key] = value
        return profile
        
car_profile = build_carinfo('audi','a4',car_typy='limousine',drive_type='gas')
print(car_profile)
结果打印为:
{'brand_name': 'audi', 'car_name': 'a4', 'car_typy': 'limousine'}
为什么少了一项?求大神帮助!!
搜索更多相关主题的帖子: 函数 调用 打印 结果 profile 
2019-07-26 09:43
aa2820981
Rank: 1
等 级:新手上路
帖 子:28
专家分:0
注 册:2019-7-16
得分:0 
回复 2楼 wp231957
懂了,谢谢!
2019-07-26 20:09



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-496041-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.341014 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved