摘要: https://www.cnblogs.com/linhaifeng/articles/6113086.html —————————————————————————————————————— 九、匿名函数 运行结果: 11 <function calc at 0x0000000002311D08>< 阅读全文
posted @ 2018-05-30 21:19 小飞侠Kobe 阅读(132) 评论(0) 推荐(0) 编辑
摘要: https://www.cnblogs.com/linhaifeng/articles/6113086.html —————————————————————————————————————— 八、函数的作用域 运行结果:in the test<function test1 at 0x0000021B 阅读全文
posted @ 2018-05-30 14:25 小飞侠Kobe 阅读(145) 评论(0) 推荐(0) 编辑
摘要: https://www.cnblogs.com/linhaifeng/articles/6113086.html —————————————————————————————————————— 七、递归 运行结果:105211 思路: 10,5,2,1是calc运行时输出的最后一个1是res接收到re 阅读全文
posted @ 2018-05-29 21:12 小飞侠Kobe 阅读(285) 评论(0) 推荐(0) 编辑
摘要: https://www.cnblogs.com/linhaifeng/articles/6113086.html —————————————————————————————————————— 六、前向引用之'函数即变量' 运行结果:NameError: name 'bar' is not defin 阅读全文
posted @ 2018-05-29 12:32 小飞侠Kobe 阅读(455) 评论(0) 推荐(0) 编辑
摘要: https://www.cnblogs.com/linhaifeng/articles/6113086.html —————————————————————————————————————— 五、局部变量与全局变量 在子程序中定义的变量称为局部变量,在程序的一开始定义的变量称为全局变量。全局变量作用 阅读全文
posted @ 2018-05-28 17:21 小飞侠Kobe 阅读(266) 评论(0) 推荐(0) 编辑
摘要: https://www.cnblogs.com/linhaifeng/articles/6113086.html ——————————————————————————————————————一、python中函数定义:函数是逻辑结构化和过程化的一种编程方法。python中函数定义方法: def te 阅读全文
posted @ 2018-05-27 22:03 小飞侠Kobe 阅读(350) 评论(0) 推荐(0) 编辑
摘要: 字符串格式化 —————————————————————————————————————————————————————一、百分号方式 #%s用于接收str格式,但数字,列表也能接收 msg='i am %s my hobby is %s' % ('lhf','alex')print(msg) 运行 阅读全文
posted @ 2018-05-27 16:08 小飞侠Kobe 阅读(109) 评论(0) 推荐(0) 编辑
摘要: s=set('hello')print(s) 运行结果:{'l', 'o', 'e', 'h'} s=set(['alex','alex','sb'])print(s) 运行结果:{'sb', 'alex'} s={1,2,3,4,5,6} #添加s.add('s')s.add('3')s.add( 阅读全文
posted @ 2018-05-27 14:12 小飞侠Kobe 阅读(123) 评论(0) 推荐(0) 编辑
摘要: db={'上海':{}, '北京':{ '昌平':{ '沙河':{}, '回龙观':{}, }, '朝阳':{}, '海淀':{}, }} path=[] while True: temp=db for item in path: te... 阅读全文
posted @ 2018-05-25 15:01 小飞侠Kobe 阅读(379) 评论(0) 推荐(0) 编辑
摘要: #字典 dict#1.字典的格式:键值对info = {'k1':'v1','k2':'v2'} #2.字典的value可以是任何值#3.列表、字典不能作为字典的key#4.字典是无序的 info = {'k1': 18, 2: True, 'k3': [11, [], (), 22, 33, {' 阅读全文
posted @ 2018-05-23 23:10 小飞侠Kobe 阅读(132) 评论(0) 推荐(0) 编辑