binascii模块拿来干嘛的?

答:进制转换xxoo

 #!/usr/bin/env python
# encoding:utf-8
# by i3ekr import binascii
s = "abcd"
a = binascii.b2a_hex(s)#字符串转十六进制
b = binascii.a2b_hex(a)#十六进制转字符串
print a,b
c = binascii.b2a_base64(s)#base64加密
d = binascii.a2b_base64(c)#base64解密
print c,d

输出效果截图:

  python中的binascii模块-LMLPHP

05-11 18:09