南邮21栋

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2017年11月13日

摘要: class User(): def __init__(self,first_name,last_name,*toppings): # *toppings (带*号表示任意数量的形参) self.extra_info = [] # 建立空列表,作为容纳可选实参的空间,这里要注意为了能够在整个 self 阅读全文
posted @ 2017-11-13 20:41 南邮21栋 阅读(331) 评论(0) 推荐(0) 编辑

摘要: def build_profile(first,last,**user_info): #**号创建空字典 """creat a dictionary,including all of users which we know""" profile = {} #程序的关键部分就是字典的建立,首先有一个空 阅读全文
posted @ 2017-11-13 10:50 南邮21栋 阅读(266) 评论(0) 推荐(0) 编辑