Pythonのお勉強 Part ..
[2ch|▼Menu]
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