The following APIs are capable of handling Unicode objects and strings on input (we refer to them as strings in the descriptions) and return Unicode objects or integers as appropriate.
They all return NULL or -1
if an exception occurs.
PyObject *left, PyObject *right) |
PyObject *s, PyObject *sep, Py_ssize_t maxsplit) |
PyObject *s, int keepend) |
PyObject *str, PyObject *table, const char *errors) |
The mapping table must map Unicode ordinal integers to Unicode ordinal integers or None (causing deletion of the character).
Mapping tables need only provide the __getitem__() interface; dictionaries and sequences work well. Unmapped character ordinals (ones which cause a LookupError) are left untouched and are copied as-is.
errors has the usual meaning for codecs. It may be NULL which indicates to use the default error handling.
PyObject *separator, PyObject *seq) |
PyObject *str, PyObject *substr, Py_ssize_t start, Py_ssize_t end, int direction) |
-1
if an error occurred.
PyObject *str, PyObject *substr, Py_ssize_t start, Py_ssize_t end, int direction) |
-1
indicates that no
match was found, and -2
indicates that an error occurred and
an exception has been set.
PyObject *str, PyObject *substr, Py_ssize_t start, Py_ssize_t end) |
str[start:end]
. Return -1
if an
error occurred.
PyObject *str, PyObject *substr, PyObject *replstr, Py_ssize_t maxcount) |
PyObject *left, PyObject *right) |
PyObject *left, PyObject *right, int op) |
Rich compare two unicode strings and return one of the following:
NULL
in case an exception was raised
Note that Py_EQ and Py_NE comparisons can cause a UnicodeWarning in case the conversion of the arguments to Unicode fails with a UnicodeDecodeError.
Possible values for op are Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, and Py_LE.
PyObject *format, PyObject *args) |
format % args
. The
args argument must be a tuple.
PyObject *container, PyObject *element) |
element has to coerce to a one element Unicode
string. -1
is returned if there was an error.
See About this document... for information on suggesting changes.