填充0的操作,使用zfill也可以,默认在字符串的左侧填充指定数量的零。 hex(int(bin(int(x, base=16))[2:].zfill(4)[::-1], base=2))[2:].upper()
点赞

相关推荐

牛客网
牛客企业服务