ローカル変数の一覧を取得
Posted feedbacks - Python
これはpythonからの挑戦状かな?
1 2 3 4 5 6 | def foo():
x = 1
y = "hello"
result = locals()
return result
print foo()
|
ローカル変数の一覧を取得
1 2 3 4 5 6 | def foo():
x = 1
y = "hello"
result = locals()
return result
print foo()
|
にしお
#3391()
Rating0/0=0.00
Pythonで表現すると、下のコードの???部分を埋めることになります。
>>> def foo(): x = 1 y = "hello" ??? return result >>> foo() {'y': 'hello', 'x': 1}[ reply ]