First page Back Continue Last page Overview Image

Beispiele für PyArg_ParseTuple

int ok;

int i, j;

char *s;

int size;

char *file;

char *mode = "r";

int bufsize = 0;

A pair of integers und ein String:

ok = PyArg_ParseTuple(args,"(ii)s#", &i, &j, &s);

/* Possible Python call: f((1, 2), 'three') */

Ein String, optional ein weiterer String und eine Integer:

ok = PyArg_ParseTuple(args, "s|si", &file, &mode, &bufsize);

/* Possible Python calls:

f('spam')

f('spam', 'w')

f('spam', 'wb', 100000) */