| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1111 人关注过本帖
标题:函数调用打印结果不完全
取消只看楼主 加入收藏
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
快速回复:函数调用打印结果不完全
数据加载中...
 
   



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

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