How to stringfy a swig matrix object in python

Posted by leo on Stack Overflow See other posts from Stack Overflow or by leo
Published on 2010-03-30T21:10:50Z Indexed on 2010/03/30 21:13 UTC
Read the original article Hit count: 466

Filed under:
|

Hi, I am using swig wrapper of openbabel(written in C++, and supply a python wrapper through swig)

Below i just use it to read a molecule structure file and get the unitcell property of it. import pybel for molecule in pybel.readfile('pdb','./test.pdb'): unitcell = molecule.unitcell print unitcell |..>
|..>
>

The unitcell has function CellMatrix(),

unitcell.GetCellMatrix() <22> >

the OpenBabel::matrix3x3 is something like :

1 2 3 4 5 6 7 8 9 i am wondering how to print out the contents of the matrix3*3 . I have tried str and repr with it.

Any general way to stringfy the contents of a matrix wrapped by swing in python ?

thanks

© Stack Overflow or respective owner

Related posts about python

Related posts about swig