|
||||||||
eval() and exec() - Python Automation and Machine Learning for ICs - - An Online Book - |
||||||||
| Python Automation and Machine Learning for ICs http://www.globalsino.com/ICs/ | ||||||||
| Chapter/Index: Introduction | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | Appendix | ||||||||
================================================================================= The functions eval() and exec() can execute arbitrary code, which poses security risks and makes the code less readable and maintainable. Avoid using them unless absolutely necessary. An example of using eval() is code: Output: ============================================ Watchdog for monitoring specific file or files with a specific file + specific extension, and then run another file from watchdog: in this set of program, three scripts are excuted: two provide the same function by calling each other, the third one is a file with functions which needs to be excuted: Code 1, Code 2, and Fuction Code:
|
||||||||
| ================================================================================= | ||||||||
|
|
||||||||