gcodeBuddy is a python library intended to ease the process of writing to, reading from, and interpreting g-code files, particularly geared towards 3D printer g-code flavors like Marlin.
Use the package manager pip to install gcodeBuddy.
pip install gcodeBuddy
https://gcodebuddy.readthedocs.io/
Pull requests are more than welcome. For most cases, open an issue first to discuss what you would like to change.