Python论坛  - 讨论区

标题:[python-chinese] Rs: help, thanks very much.

2008年01月16日 星期三 10:01

bill.wu bill.wws在gmail.com
星期三 一月 16 10:01:17 HKT 2008

ÎÒÏëÎÊһϣ¬ÕâÁ½¸öº¯ÊýµÄµÄ def func£¨x£©ºÍfunc£¨£© Ò»¸ö´øXÒ»¸ö²»´øX£¬ÇëÎÊÊÇʲôÇø±ð£¿ÎªÊ²Ã´£¿


(1)

def func(x):
    print 'x is', x
    x = 2
    print 'Changed local x to', x

x = 50
func(x)
print 'x is still', x (2)

def func():
    global x

    print 'x is', x
    x = 2
    print 'Changed local x to', x

x = 50
func()
print 'Value of x is', x 

____________________________________________________________________

____________________________________________
DreamMail - µç×ÓÓʼþÐÂÌåÑé www.dreammail.org
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20080116/91210a04/attachment-0001.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]
zy

zy

2008年01月16日 星期三 12:15

Lich_Ray solo.lich在gmail.com
星期三 一月 16 12:15:07 HKT 2008

Ò»¸öÐ޸ı¾µØ±äÁ¿Ò»¸öÐÞ¸ÄÈ«¾Ö±äÁ¿ß¡£

ÔÚ08-1-16£¬bill.wu <bill.wws在gmail.com> дµÀ£º
>
>  ÎÒÏëÎÊһϣ¬ÕâÁ½¸öº¯ÊýµÄµÄ def func£¨x£©ºÍfunc£¨£© Ò»¸ö´øXÒ»¸ö²»´øX£¬ÇëÎÊÊÇʲôÇø±ð£¿ÎªÊ²Ã´£¿
>
>
>    (1)
>
> def func*(x)*:
>     print 'x is', x
>     x = 2
>     print 'Changed local x to', x
>
> x = 50
> func*(x)*
> print 'x is still', x
>  (2)
>
> def func*()*:
>     global x
>
>     print 'x is', x
>     x = 2
>     print 'Changed local x to', x
>
> x = 50
> func*()*
> print 'Value of x is', x
> ____________________________________________________________________
> ____________________________________________
> *DreamMail* - µç×ÓÓʼþÐÂÌåÑé www.dreammail.org
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>



-- 
Ray Stinger, nickname Lich_Ray
God is in his heaven, all's right with the world.
-------------------------------------------------
let focus = 'computing' in where:
http://lichray.javaeye.com
let focus = 'computing' in here:
http://lichray.bokeland.com
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20080116/121fb7f5/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2024

    京ICP备05028076号