This topic created in 2066 days ago, the information mentioned may be changed or developed.
各位大佬,小弟遇到一个技术问题,例如现在有个形式如:b'\xc2\x1d'的 bytes 类型数据,此时程序有个循环,每次循环的时候 bytes 增加 1,例如循环依次,变为:b'\xc2\x1e',再循环依次,变为:b'\xc2\x1f',一直循环到:b'\xff\xff',请问各位大佬有没有比较好的方法告诉我一下,如果没有的话,有没有其他可替代的方案提供小弟参考一下!
6 replies • 2021-03-13 22:19:20 +08:00
 |
|
把你的原始需求说出来吧
|
 |
|
seq = b'\xc2\x1d' (int.from_bytes(seq, 'big') + 1).to_bytes(len(seq), 'big')
|
 |
|
struct 把 bytes 转 int
|
 |
|
用 bytearray
|