How to extract a command from a string - python -


i have command this:

test = ('print( "it works!" )' ) 

and want use command inside of string. know how can extract , use it?

thank much, remus

use exec make sure trust code, ie. don't run on user submitted code security reasons

>>> test = ('print( "it works!" )' ) >>> exec test works! 

Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -