Differentiate between a string and an expression
Discussions on Python.org
Differentiate between a string and an expression
Is there a way to differentiate between a variable containing a plain string and one containing an expression, like an isexpression() function? For example how can I establish between these two: test1 = print("hello") # <- expression test2 = 'print("hello")' # <- string A clearer demonstration of one reason why I need to establish between a string and a function: in_str = '"a {myVar} string"' stored_code1 = 'f' + in_str print(stored_code1) in_str = 'aFunc("param1", "param2")' stored_code2 =...
0 comments
No comments yet.