Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Execution command?
-
Is there any way to execute code within a program from a URL? I want to put some code on a google sites then execute that code but is there a command to execute a string?
-
@Brando you can execute a string with
exec
. In python2:exec string_here
, In python3:exec(string_here)
.
To download the code, use therequests
orurllib
module. Example (python2):import urllib\nexec urllib.urlopen(some_url_here).read()
orimport requests\nexec requests.get(some_url_here).text