简体   繁体   中英

How does one produce a specific unicode character with Python's C-API?

I'm writing a Python extension that runs through a Py_UNICODE array, finds specific (ASCII, if it matters) characters, ie '\\' or '\\n', and does some additional stuff for each one that it finds.

Is there a way to write those characters as literals? If not, what is the correct way to obtain Py_UNICODEs for them, keeping in mind that Py_UNICODE's size and internal representation may differ from system to system?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM