Pythonのお勉強 Part ..
57:デフォルトの名無しさん
08/05/02 00:02:26
>>> x = 'global'
>>> def f():
... print x
...
>>> f()
global
>>> def f2():
... print x
... x = 'local'
...
>>> f2()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "<stdin>", line 2, in f2
UnboundLocalError: local variable 'x' referenced before assignment
ってなるのは何故?
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
5398日前に更新/131 KB
担当:undef