![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
小学生胖元
一个无知的小学生
展开
-
将键值对当作实参传进函数
def build_profile(first,last,**user_info): profile={} profile['firstname']=first profile['lastname']=last for k,v in user_info.items(): profile[k]=v return profileuser_profile=bu...原创 2018-03-16 14:28:31 · 883 阅读 · 0 评论 -
关于for循环处理列表的思考
1、在for循环中删除列表元素magicians=['jen','lexy','bob']for magician in magicians: print(magician) print(magicians[0]) del magicians[0] print(magician) print(magicians) print('\n') jen jen je...原创 2018-03-16 14:30:58 · 238 阅读 · 0 评论 -
关于类的tips
1、创建类时init函数是两个下划线2、访问属性和访问方法的exampleclass Restaurant(): def __init__(self,restaurant_name,cuisine_type): self.restaurant_name=restaurant_name self.cuisine_type=cuisine_type def de...原创 2018-03-18 11:12:10 · 246 阅读 · 0 评论