我想将1fd93d1cf1f13d0d转换为00011111 11011001 00111101 00011100 11110001 11110001 00111101 00001101 [英] I want to convert 1fd93d1cf1f13d0d to 00011111 11011001 00111101 00011100 11110001 11110001 00111101 00001101

查看:47
本文介绍了我想将1fd93d1cf1f13d0d转换为00011111 11011001 00111101 00011100 11110001 11110001 00111101 00001101的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了以下功能:

bin(int('1fd93d1cf1f13d0d', 16)) 

但我不断得到

0b1111111011001001111010001110011110001111100010011110100001101 

作为输出.

当我使用.zfill(64)时,它变成

00b1111111011001001111010001110011110001111100010011110100001101

有人可以告诉我我做错了什么.谢谢

Can someone please tell me where i'm doing wrong. Thanks

推荐答案

hex2= 0x1fd93d1cf1f13d0d
spec = '{fill}{align}{width}{type}'.format(fill='0', align='>', width=64, type='b')
bin_representation = format(hex2, spec)
print(bin_representation)

将您的字符串表示为hexformat.hope即可解决.根据您想要的输出进一步格式化

represent your string into hexformat.hope it solves. format further according to your desired output

这篇关于我想将1fd93d1cf1f13d0d转换为00011111 11011001 00111101 00011100 11110001 11110001 00111101 00001101的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆