2016年10月28日

进阶 第四课:函数(第四节)

摘要: step1: 习题反馈 step2: lambda之再议 1. lambda是一个表达式 2. 它没有名称,存储也不是代码块,而是表达式 3. 它被用作执行很小单元, 不能在里面使用条件语句 step3:参数总结 1. 位置匹配 func(name) 2. 关键字匹配 func(key=value) 3. 收集匹配 1)元组收集 func(name,... 阅读全文

posted @ 2016-10-28 22:54 慧命 阅读(266) 评论(0) 推荐(0) 编辑

实战篇一 python常用模块和库介绍

摘要: # -_-@ coding: utf-8 -_-@ -- Python 常用模块和库介绍 第一部分:json模块介绍 import json 将一个Python数据结构转换为JSON: dict_ = {1:2, 3:4, "55":"66"} # test json.dumps print type(dict_), dict_ json_str = j... 阅读全文

posted @ 2016-10-28 07:16 慧命 阅读(1389) 评论(0) 推荐(0) 编辑

进阶 第三课:函数(第三节)

摘要: 1. 习题反馈 2. 自省与函数 func.__code__ def func1(arg1, arg2): return arg1*arg2 print dir(func1.__code__) print func1.__code__.co_varnames print func1.__code__.co_filename 3. 作用域问题再议 arg =1 def... 阅读全文

posted @ 2016-10-28 07:14 慧命 阅读(230) 评论(0) 推荐(0) 编辑

导航