小编p19*_*p19的帖子

Clojure 相当于 python 的 base64 编码和解码

我有这个 python 代码片段,需要 clojure 等价物的帮助。

user_id = row.get('user_id')
if user_id:
    user_id_bytes = base64.urlsafe_b64decode(user_id)
    creation_timestamp = int.from_bytes(user_id_bytes[:4],
                                    byteorder='big')
    dc_id = int.from_bytes(user_id_bytes[4:5], byteorder='big') & 31
    if creation_timestamp > WHEN_WE_SET_UP_DC_IDS:
        row['dc_id'] = dc_id}
Run Code Online (Sandbox Code Playgroud)

python clojure

1
推荐指数
1
解决办法
1015
查看次数

标签 统计

clojure ×1

python ×1