#本程序没有考虑对0x的处理,请勿输入,直接输入16进制位即可
begin = input("起始点:")
end = input("结束点:") b_int0 = 0
e_int0 = 0 b_len = len(begin) e_len = len(end) dit0 = ['a','b','c','d','e','f']
dit1 = ['A','B','C','D','E','F']
dit = dit0[:] + dit1[:]
if begin>end or begin == end: #筛选条件,待补充,有漏洞,如‘FF’与‘1FF’
print("error!!")
else:
for i in range(b_len): #按照0x56 = 5*16+6的思路进行逐位运算
if begin[i] in dit:
for j in range(0,6,1):
if begin[i] == dit0[j]: #此处分两词典只是单纯适应原程序
b = 10 + j
if begin[i] == dit1[j]: #16进制有A~F,应分开筛选
b = 10 + j
elif int (begin[i]) <= 9:
b = int (begin[i])
b_len = b_len-1 #此处是为了降低运算位,从效果上看并不影响前面的range(b_len)
b = b*16**(b_len)
b_int0 += b
for i in range(e_len):
if end[i] in dit:
for j in range(0,6,1):
if end[i] == dit0[j]:
e = 10 + j
if end[i] == dit1[j]:
e = 10 + j
elif int (end[i]) <= 9:
e = int (end[i])
e_len = e_len-1
e = e*16**(e_len)
e_int0 += e
for i in range(b_int0,e_int0+1,1):
print(chr(i))

附:下列转载自:https://blog.csdn.net/gywtzh0889/article/details/71083459

输出一定范围unicode对应符号-LMLPHP

输出一定范围unicode对应符号-LMLPHP

05-19 14:05