小编rig*_*cky的帖子

Cython: when should I define a string as char*, str, or bytes?

When defining a variable type that will hold a string in Cython + Python 3, I can use (at least):

cdef char* mystring = "foo"
cdef str mystring = "foo"
cdef bytes mystring = "foo"
Run Code Online (Sandbox Code Playgroud)

The documentation page on strings is unclear on this -- it mostly gives examples using char* and bytes, and frankly I'm having a lot of difficulty understanding it.

In my case the strings will be coming from a Python3 program and are assumed to be …

python string cython python-3.x

4
推荐指数
1
解决办法
1867
查看次数

标签 统计

cython ×1

python ×1

python-3.x ×1

string ×1