O'Reilly logo

Python Essential Reference, Second Edition by David M Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Converting Data from Python to C

The following functions are used to convert arguments passed from Python to C.

					int PyArg_ParseTuple(PyObject *
					args, char *
					format, ...);
				

Parses a tuple of objects in args into a series of C variables. format is a format string containing zero or more of the specifier strings from Table B.1, which describes the expected contents of args . All the remaining arguments contain the addresses of C variables into which the results will be placed. The order and types of these arguments must match the specifiers used in format and use the C datatypes listed in Table B.1. Zero is returned if the arguments could not be parsed.

					int PyArg_ParseTupleAndKeywords(PyObject *
					args, PyObject *
					kwdict,
					char *
					format, char ** ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required