php和python 中变量作用域的解析
2016-02-26 20:55
811 查看
var_dump($a);
$a = 2;
var_dump($a);
在php会输出 NULL int(2)
a=2
def f():
print a;
a= 2;
print a;
f()
python会报错 因为函数的内部作用域中有符号a 但是执行第一个print a 时 却发现没有符号和应用的约定(取值)
$a = 2;
var_dump($a);
在php会输出 NULL int(2)
a=2
def f():
print a;
a= 2;
print a;
f()
python会报错 因为函数的内部作用域中有符号a 但是执行第一个print a 时 却发现没有符号和应用的约定(取值)
相关文章推荐
- Python小知识点(持续更新)
- python string模块
- [Leetcode]@python 100. Same Tree
- [Leetcode]@python 99. Recover Binary Search Tree
- [Leetcode]@python 98. Validate Binary Search Tree
- [Leetcode]@python 97. Interleaving String
- [Leetcode]@python 96. Unique Binary Search Trees
- Python2.7 urlparse学习
- python 二叉树
- python pip安装使用
- 怎么写python字符串截取
- python——strip,lstrip和rstrip
- Python学习笔记 - 9.元组(Tuple)
- python random模块
- Python作为移动客户端后台服务器
- mysql的python API
- Python中正则表达式的一些匹配规则
- 利用Python进行文章特征提取(一)
- python mysql
- Python语言特性