The <code>openbabel</code> module is designed to allow Python scripts to use the C++ Open Babel library. The wrapper is generated using the SWIG package and provides access to almost all of the Open Babel interfaces via Python, including the base
classes OBMol, OBAtom, OBBond, and OBResidue, as well as the conversion framework OBConversion.
</p>
<p>
As such, essentially any call in the C++ API is available to Python scripts with very little difference in syntax. This guide is designed to give examples of common Python syntax for the <code>openbabel</code> module and pointers to the appropriate sections of the API documentation.
</p>
<p>
The example script below creates atoms and bonds one-by-one using the OBMol, OBAtom, and OBBond classes.
More commonly, Open Babel can be used to read in molecules using the OBConversion framework. The following script reads in molecular information (a SMI file) from a string, adds hydrogens, and writes out an MDL file as a string.
That's it! There's more information on particular calls in the <ahref="http://openbabel.org/api/">library API</a>. Feel free to address questions to the <ahref="mailto:openbabel-scripting@lists.sourceforge.net">openbabel-scripting</a> mailing list.