码迷,mamicode.com
首页 > 编程语言 > 详细

Python 学习5

时间:2016-10-04 07:30:05      阅读:126      评论:0      收藏:0      [点我收藏+]

标签:

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

标签:

原文地址:http://www.cnblogs.com/kingoscar/p/5930012.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!