摘要: 第一:如定义在类或者函数体外,在函数或者类中引用需要用到 global声明 temp_t = "ceshi" def tmp1(): global temp_t temp_t =1 print temp_t 结果:1 第二:直接在函数或类中定义,需要先执行函数或者类,才能执行输出 def a(): global cc cc = "bb" d... 阅读全文
posted @ 2019-07-01 18:42 代码家园 阅读(50659) 评论(0) 推荐(3) 编辑