A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/083062.html below:

Call a function using a variable

Call a function using a variable Call a function using a variableAndrew Dalke dalke at acm.org
Fri Apr 27 17:15:57 EDT 2001
Colin Meeks asked:
>Does anybody know if it's possible to do something along the following
lines
>:
>
>myfunction="test"
>x=myfunction

>>> def test(): print "Testing!"
...
>>> myfunction = globals()["test"]
>>> myfunction()
Testing!
>>>

                    Andrew
                    dalke at acm.org




More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4