如果不存在,如何为字节添加自定义__lshift__和__rshift__?

问题描述

我想为bytes类型添加循环移位,但是不能为该类型编写新的__lshift____rshift__。我不只是想像使用>><<那样做一个函数 使事情变得容易得多。


bytes.__lshift__ = lshiftfunc  # circular shift function

结果:

Traceback (most recent call last):
  File "<input>",line 1,in <module>
AttributeError: 'bytes' object has no attribute '__lshift__'

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)