2007年11月23日 星期五 16:14
ÏÂÃæÒ»¶Î³ÌÐòµÄ´íÎóÌáʾ£¬ÊDz»ÊǺÍpythonµÄ°æ±¾ÓйØϵÄØ There is an error in your program ***name 'x' is local and global Ô´´úÂëÈçÏ #!/usr/bin/python # Filename:func_global.py def func(x): global x print 'x is' , x x=2 print 'Changed global x to',x x=50 func(x) print 'Value of x is',x -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20071123/4603f103/attachment.htm
2007年11月23日 星期五 17:06
ÄãµÄ²ÎÊýÁбíÀïÓбäÁ¿x£¬ÒѾÊÇlocalÁË£¬ÈκÎÓïÑÔÔÔòÉÏlocal²»¸²¸ÇÉϼ¶¡£ ÄѵÀûעÒâµ½ÕâÊÇÒ»¸öSyntaxErrorÂð£¿Òâ˼¾ÍÊÇ˵²»ÓÃÖ´ÐУ¬Ð´·¨¾ÍÊÇ´íµÄ¡£ ÔÚ07-11-23£¬Pattern Liu <liufengsjtu在gmail.com> дµÀ£º > > ÏÂÃæÒ»¶Î³ÌÐòµÄ´íÎóÌáʾ£¬ÊDz»ÊǺÍpythonµÄ°æ±¾ÓйØϵÄØ > There is an error in your program > ***name 'x' is local and global > > Ô´´úÂëÈçÏ > #!/usr/bin/python > # Filename:func_global.py > def func(x): > global x > print 'x is' , x > x=2 > print 'Changed global x to',x > x=50 > func(x) > print 'Value of x is',x > > > > _______________________________________________ > 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/20071123/7f860ecd/attachment.htm
2007年11月27日 星期二 01:35
name 'x' is local and global È˼ÒPython²»ÊǸæËßÄãÁËÂ𣿣¡ ˵ÄãxÊǾֲ¿ÓÖÊÇÈ«¾Ö£¬ÄãÖ»ÄÜÑ¡Ò»¸ö£¬²»ÄÜÁ½¸ö¶¼Òª£¬¾ßÌåÒªÄĸö¾ÍÄã×Ô¼º¿´×Å°ìÁË¡£ On Nov 23, 2007 5:06 PM, Lich_Ray <solo.lich at gmail.com> wrote: > ÄãµÄ²ÎÊýÁбíÀïÓбäÁ¿x£¬ÒѾÊÇlocalÁË£¬ÈκÎÓïÑÔÔÔòÉÏlocal²»¸²¸ÇÉϼ¶¡£ > ÄѵÀûעÒâµ½ÕâÊÇÒ»¸öSyntaxErrorÂð£¿Òâ˼¾ÍÊÇ˵²»ÓÃÖ´ÐУ¬Ð´·¨¾ÍÊÇ´íµÄ¡£ > > ÔÚ07-11-23£¬Pattern Liu <liufengsjtu at gmail.com > дµÀ£º > > > > ÏÂÃæÒ»¶Î ³ÌÐòµÄ´íÎóÌáʾ£¬ÊDz»ÊǺÍpythonµÄ°æ±¾ÓйØϵÄØ > > > > There is an error in your program > > ***name 'x' is local and global > > > > Ô´´úÂëÈçÏ > > #!/usr/bin/python > > # Filename:func_global.py > > def func(x): > > global x > > print 'x is' , x > > x=2 > > print 'Changed global x to',x > > x=50 > > func(x) > > print 'Value of x is',x > > > > > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to > > python-chinese-request at 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 > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > -- About Cyril.Liu ----------------------------------- Cyril ÊÇÒ»¸ö³ÌÐòÔ±, ÏÖÔÚÊǸöÇî¹âµ°, Ëû³£³£¸ú×Ô¼ºËµ:"ÎÒÕÒ»ÓÐÀíÏëþÎÅ£×Ð×Ð" -------------- next part -------------- An HTML attachment was scrubbed... URL: http://python.cn/pipermail/python-chinese/attachments/20071127/23b92495/attachment-0001.htm
Zeuux © 2025
京ICP备05028076号