首页 > 代码库 > Python 学习5
Python 学习5
1. Global scope value can not be changed in function.
2. We can define a global variable in a function by using global.
3. Rules of using variable:
- First start with the local scope, if any. If the variable is defined here, use the value.
- Look at any enclosing scopes, starting with the innermost. These are "outside" local scopes. If the variable is defined in any of them, use the value.
- Look in the global scope. If the variable is there, use the value.
- Finally, look in the built-in functions.
- If no value is found, an error will be thrown.
Regular Expression(for extract number from a long string):
1.
Python 学习5
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。