首页 > 编程语言 > 详细

Python 学习5

时间:2016-10-04 07:29:02      阅读:181      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!