maomao2028 0 Posted April 11 In delphi, with the help of p4d's mainmodule.xxx(v), the python function is called, where the v input is the bytes type, how to convert Tbytes to bytes type in Delphi Share this post Link to post
pyscripter 689 Posted April 11 (edited) Look at PyBytes_AsString, or PyBytes_AsStringAndSize functions. For example if obj is a bytes PPyObject. the following converts it to an AnsiString. AnsiString(PyBytes_AsString(obj)) Also PyObjectAsVariant(obj) converts it to a variant. In the opposite direction to create a bytes object in Delphi use PyBytes_FromStringAndSize Edited April 11 by pyscripter Share this post Link to post