【发布时间】:2017-04-13 16:01:07
【问题描述】:
我正在编写一个蒸汽机器人。一个库是用 Python 3.5 编写的,但我在 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 它应该返回 account_id 以防 76561198081423873 为 121158145
有人知道怎么处理吗?
【问题讨论】:
-
为什么在 python 2.7 中需要它?将(自己)迁移到 python 3.5 会不会更容易?
-
另外一个(更复杂的)库是用于 python 2.7