0
我正在编程蒸汽机器人。一个库是用Python 3.5编写的,但是我需要它在Python 2.7中,所以我正在重写它。但是我不知道如何重写这个函数有人可以帮我吗?Python 3.5 to_bytes Python 2.7
def steam_id_to_account_id(steam_id):
return unicode(struct.unpack(u'>L', int(steam_id).to_bytes(8, byteorder=u'big')[4:])[0])
steam_id将是像76561198081423873 一个整数,它应该在的情况下为76561198081423873返回ACCOUNT_ID这将是121158145
是否有人知道该如何处理呢?
的可能的复制[有Python的3 \ _bytes一直向下移植到Python 2.7?(http://stackoverflow.com/questions/16022556/has-python-3-to-bytes-been-back-ported-to-python-2-7) – MooingRawr
为什么你需要它在python 2.7中?将(自己)移动到python 3.5不是更容易吗? –
那么另一个(更复杂的)库是用于python 2.7的 –