How to convert a PyObject in Python C-extension to a string type?
-
12-06-2021 - |
Question
Just can't find the right function. Thanks for advice.
La solution
You're looking for PyObject_Str
:
PyObject* PyObject_Str(PyObject *o)
Return value: New reference.
Compute a string representation of object
o
. Returns the string representation on success,NULL
on failure. This is the equivalent of the Python expressionstr(o)
. Called by thestr()
built-in function and by the
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow