[Tutor] Rs: help, thanks very much.
bill.wu
bill.wws at gmail.com
Wed Jan 16 03:01:49 CET 2008
i am new guy.
i ask a easy question.
why the first one have"x",the second one doesn't have "x". what is different? when write "x",when don't write "x".
in my point,the second one don't def variable.
(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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080116/e4e7f082/attachment.htm
More information about the Tutor
mailing list