python核心编程-函数-内嵌函数
来源:互联网 发布:2017年国产动漫数据 编辑:程序博客网 时间:2024/05/16 04:52
#!/usr/bin/env python# -*- coding: UTF-8 -*- def foo(): def bar(): #bar只在foo函数的作用域内 print 'bar() called' print 'foo() called' bar()if __name__ == '__main__': foo() bar()
输出:
D:\Python27\test>func4.pyfoo() calledbar() calledTraceback (most recent call last): File "D:\Python27\test\func4.py", line 13, in <module> bar()NameError: name 'bar' is not definedD:\Python27\test>
0 0
- python核心编程-函数-内嵌函数
- python核心编程-传递调用内建函数
- [Python]核心编程之函数
- python核心编程-函数调用
- python核心编程-诊断函数
- python核心编程-filter函数
- python核心编程-map函数
- python核心编程-reduce函数
- python核心编程-partial函数
- Python 核心编程笔记_Chapter_4_Note_2 内建函数(built-in functions)
- Python 核心编程笔记_Chapter_6_Note_2 字符串的内建函数zip_转义字符_字符串术语
- Python 核心编程笔记_Chapter_6_Note_3 列表_列表内建函数
- 《Python核心编程》函数---学习笔记
- python核心编程-函数返回值
- python核心编程-函数参数传递
- python核心编程-函数-装饰器
- python核心编程-默认函数对象参数
- python核心编程-filter函数重构
- 装饰模式实例与UML
- [iOS 开发问题解决]kCFStreamNetworkServiceTypeVoIP' is deprecated
- 更改实体字段类型,引用实体的类会重新编译【java.lang.NoSuchMethodError】
- 易错
- 三个有意思的php函数
- python核心编程-函数-内嵌函数
- windows溢出保护原理与绕过方法概览
- Lighty的Chunk设计
- 培训机构毕业的程序员被歧视的背后逻辑
- python核心编程-函数-装饰器
- MyBatis学习笔记二
- 自动布局神器 -- ZXPAutoLayout框架的使用
- Linux内核zero-copy小试牛刀(加注释)
- Android应用集成微信支付