Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
A word on the Python API

The Python API is highly similar to the C++ one. The main modules to import are:

  • MEDCoupling
  • MEDLoader (with mainly the static MEDLoader class within this module)

The following intuitive rules have been used to map the C++ objects to the Python ones:

1 import MEDCoupling as mc
2 d = mc.DataArrayInt([(1,2), (3,4), (5,6)], 3, 2) # an array of 3 tuples with 2 components
3 print d[:,1] # show only second component of the array: 2,4,6

Finally for the most common objects (DataArray, MEDCouplingUMesh, etc ...) one can direclty access the Doxygen documentation in the interactive Python interpreter using the built-in help function from Python:

1 import MEDCoupling as mc
2 help(mc.DataArrayDouble.getNumberOfTuples)