Electron microscopy
 
PythonML
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:
          Code 1:
                Watchdog for Monitoring Specific File or Files with Specific Extension
          Code 2:
                Watchdog for Monitoring Specific File or Files with Specific Extension
          Function Code:
                Watchdog for Monitoring Specific File or Files with Specific Extension
         Run any of the two Code 1 or Code 2, then the following is seen.
         Step 1: Original folders and files in the folder:
                Watchdog for Monitoring Specific File or Files with Specific Extension
          Step 2: Start to run Code:
               Watchdog for Monitoring Specific File or Files with Specific Extension
          Step 3: Copy a file "Word.PNG" into the folder:
               Watchdog for Monitoring Specific File or Files with Specific Extension
          Step 4: Output:
               Watchdog for Monitoring Specific File or Files with Specific Extension
          Step 5: Delete the file, then no new output:
               Watchdog for Monitoring Specific File or Files with Specific Extension
          Step 6: Copy two files into it, then Function 2 is excuted:
               Watchdog for Monitoring Specific File or Files with Specific Extension
          Step 7: The output obtained by running Code 2:
               Watchdog for Monitoring Specific File or Files with Specific Extension
          Step 8: lower level folder:
               Watchdog for Monitoring Specific File or Files with Specific Extension
          Step 9: Copy the file into the folder:
               Watchdog for Monitoring Specific File or Files with Specific Extension
          Step 10: Output:
               Watchdog for Monitoring Specific File or Files with Specific Extension
         

         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         

 

 

 

 

 



















































 

 

 

 

 

=================================================================================