How to Convert a PyObject to a string

phill superfix at bol.com.br
Mon Sep 24 13:45:49 EDT 2001


Hello

 I need to convert a PyObject to a string in C.
 Does anybody know some function that do this?
 Ex.:

// this function receive a list
static PyObject *Convert(PyObject *self, PyObject *args)
{
   PyObject *strList;
   char *strVar;
   int x,y;
   PyObject *auxiliar;
   
   if (!PyArg_ParseTuple(args, "O",&strList))
          return NULL;
      
   y = PyList_Size(strList);
   auxiliar = PyList_GetItem(strList,0);

   // this part does not function
   strVar = &auxiliar; // my attempt to convert

   cout <<"valor de x = "<< x << endl;
   
   return Py_BuildValue("O", auxiliar);
}

Thanks.

Phill.

 
__________________________________________________________________________
AcessoBOL, só R$ 9,90! O menor preço do mercado!
Assine já! http://www.bol.com.br/acessobol






More information about the Python-list mailing list