Python str拼接bytes
2021-01-03 13:29
                         标签:nbsp   方法   x64   拼接   %x   col   class   字节   code    困扰我很久的问题,终于解决了, 由于python3 不支持 str 和 bytes 直接拼接,所以直接 + 容易出现问题,所以这里需要转换一下。     以上就是方法,简单地说,就是一个字节一个字节转化, 然后一个字节一个字节拼接 Python str拼接bytes 标签:nbsp   方法   x64   拼接   %x   col   class   字节   code    原文地址:https://www.cnblogs.com/suanguade/p/12990228.html 1 strKey = ‘abcde‘
 2 aryKey = b‘\x83\x64\x00\x31‘
 3 print(strKey)
 4 print(aryKey)
 5 for j in aryKey :
 6     tmp = chr(j)
 7     strKey += tmp
 8 print(strKey)
 9 for j in strKey :
10     print(‘0x%X‘%ord(j))