Python executes the code block of the string

     Because I need to use python to call the python code customized in the py file at work, my idea was to start a python interpreter when executing the code and copy the python code to the interpreter. , To make it execute and get the result, it is now found that the exec function in python can execute the python code of the string, which greatly simplifies the calling project. The following reprints some knowledge about exec and exec in python. Attention is reprinted! ! ! ! ! !

Its instructions on the use of exec:

https://docs.python.org/3/library/functions.html#exec

   Make a note of it, and wait for the completion of the project to perform an instantiation analysis.

Published 10 original articles · Like 11 · Visits 20,000+

Guess you like

Origin blog.csdn.net/u013323018/article/details/105211054