tags:

views:

23

answers:

1

In python 2.x versions there is a function named as PyString_AS_STRING to convert a pyobject pointer to a string or char pointer.

How can we achieve the same functionality in python 3?

A: 

There's a PyUnicode_AS_UNICODE macro.

BTW: PyString_AS_STRING only works for string objects, returning a C string.

Ned Batchelder