批处理之家's Archiver

netdzb 发表于 2019-7-6 16:47

如何写Python程序输出的数据是十六进制的?

要求输出的数据是十六进制的。

0000
0001
0002
0003
0004
......
000E
000F

输出的数字要求是大写的。

我写的代码,有点问题啊。[code]# -*- coding: UTF-8 -*-
count = 0
while count <= 20:
      print('%032x'  count)
#  输出32位十六进制数[/code]

netdzb 发表于 2019-7-6 18:21

[b]回复 [url=http://www.bathome.net/redirect.php?goto=findpost&pid=221691&ptid=53267]1#[/url] [i]netdzb[/i] [/b]

自己搞定了
# -*- coding: UTF-8 -*-
count = 0
while count <= 20:
      print('%032x' %count)
      count = count + 1
      
#  输出32位十六进制数

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.