binascii.b2a_hex(binary_value) ##binary_value 一般读二进制文件可以得到 >>'89' <type str>
bin(10) >> '0b1010' <type, str>
oct(10) >>'012' <type, str>
hex(20) >>'0x14' <type, str>
int('20')
>>20 <type, int>
int('10', 2)
>>2 <type, int>
int('10', 8)
>>8 <type, int>
int('20', 10)
>>20 <type, int>
int('20',16)
>>32 <type, int>
chr(65) >>'A', <type, str>
ord('a')
>>97, <type, int>
#!/usr/bin/env python #encoding: utf-8 import binascii fh = open(r'C:Tempimg2012517165556.png', 'rb') a = fh.read() #print 'raw: ',`a`,type(a) hexstr = binascii.b2a_hex(a) #得到一个16进制的数 #print 'hex: ',hexstr, type(hexstr) bsstr = bin(int(hexstr,16))[2:] print 'bin: ',bsstr, type(bsstr)
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有