Convert string to Python class object? -
Looking at a string as user input for a python function, if I want to get a square object from there I am in the name hall with the name that is currently defined in the namespace. Essentially, I want to implement a function that produces such results:
square fu: pass str_to_log ("foo") ==> & Lt; On class __main__.Foo 0x69ba0 & gt;
Is this possible?
It seems simple.
& gt; & Gt; & Gt; Square Fu (object): ... pass ... pass & gt; & Gt; & Gt; Evil ("foo") & lt; Class' __main __. Foo '& gt;
Comments
Post a Comment