[英]passing byte array from c++ to python
As the title suggests, I'd like to pass a byte array from c++ to python. 如标题所示,我想将字节数组从c ++传递给python。 I understand I would need to convert my byte array into a PyObject somehow but this is where I got stuck. 我知道我需要以某种方式将字节数组转换为PyObject,但这就是我遇到的问题。 Is there anyone who can help me out with this. 有谁可以帮助我解决这个问题。
Thanks in advance, 提前致谢,
PyBytes_FromString
to the rescue assuming Python3+: PyBytes_FromString
假设Python3 +可用于救援:
https://docs.python.org/3/c-api/bytes.html https://docs.python.org/3/c-api/bytes.html
Under Python2.x PyString_FromString
: 在Python2.x下PyString_FromString
:
https://docs.python.org/2/c-api/string.html https://docs.python.org/2/c-api/string.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.