Python 我需要帮助转换C#和#x201C;(字节)值”;巨蟒

Python 我需要帮助转换C#和#x201C;(字节)值”;巨蟒,python,c#,arrays,byte,Python,C#,Arrays,Byte,在C中,我得到((字节)orderId)=93的值 但在python中,我得到的是(orderId.to_bytes)=188253 如果我尝试用python((字节)orderId) 我得到:\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0 我需要得到相同的值,但是在python中我得到(orderId.to_by

在C中,我得到
((字节)orderId)=93的值

但在python中,我得到的是
(orderId.to_bytes)=188253

如果我尝试用python
((字节)orderId)

我得到:
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0


我需要得到相同的值,但是在python中我得到(orderId.to_bytes)=188253,真的吗?这显然是错误的。@MatthewWatson是的,我不知道为什么,你知道hwa能解决这个问题吗?这就是你展示结果的方式吗?您是否正在执行打印(orderId.to_字节(8,'big'))
?@MatthewWatson否我想返回idBytes,但此代码在python中返回的结果与在C中不同,并且希望结果相同这是因为在python中(byte)orderId的结果与(orderId.to_字节)的结果不同
var orderId=188253;
var partnerId=251;

byte[] idBytes = new byte[8] { (byte)partnerId, (byte)(partnerId >> 8), (byte)(partnerId >> 16), (byte)(partnerId >> 24), (byte)orderId, (byte)(orderId >> 8), (byte)(orderId >> 16), (byte)(orderId >> 24)};