view · edit · history · print

Python Scripting

We use Python 2 - no discussion! (The reference is release 2.6, until everything and everyone uses Python 3.)

2019 UPDATE - time to move to P3!

Examples:

 
# build-in interactive debugger
$ python -m pdb script.py

# logging (structured debugging)
import logging
logging.basicConfig(level=logging.INFO, format='==> %(asctime)s,%(msecs).03d - %(levelname)s - %(message)s', datefmt='%Y%m%dT%H%M%S')
# more logging options filename='example.log', filemode='w', 
# The default levels are NOTSET, DEBUG, INFO, WARNING, ERROR and CRITICAL.
logging.info('START') # will not print anything
logging.warning('Watch out, we started.') # will print a message to the console
logging.debug('This message should not be seen')



Short tips:

Tutorials and References:

Other references (software):

Regex

admin · attr · attach · edit · history · print
Page last modified on May 08, 2019, at 12:36 PM