2014-12-20から1日間の記事一覧
Pythonでは引数として関数を渡すことができます。以下の例のfooは「引数として受け取った関数を実行する」関数です。 # test.py def foo(func): func() def bar(): print "bar" foo(bar) 実行結果 [root@localhost ~]# python test.py bar たしかに引数とし…
Pythonでは引数として関数を渡すことができます。以下の例のfooは「引数として受け取った関数を実行する」関数です。 # test.py def foo(func): func() def bar(): print "bar" foo(bar) 実行結果 [root@localhost ~]# python test.py bar たしかに引数とし…