Python chr() 命令在给定范围内整数列表时不会 return Unicode 值
Python chr() command will not return Unicode values when given list of in-range integers
这段代码应该采用整数列表并将每个整数替换为 Unicode 值(在这种情况下,chr() 使用 Unicode 而不是 ASCII 在我的 python 版本中运行),而是 returns相同的整数不变。有什么想法吗?
x = 0
while x != len(message):
encrypt[x] = chr(encrypt[x])
x=x+1
名单如下:
encrypt = [10, 20, 30, 40, 50]
你可以这样写:
encrypt = [chr(encrypt[i]) for i in range(len(message))]
但这不是答案。你能给我们原始的加密列表吗?
这段代码应该采用整数列表并将每个整数替换为 Unicode 值(在这种情况下,chr() 使用 Unicode 而不是 ASCII 在我的 python 版本中运行),而是 returns相同的整数不变。有什么想法吗?
x = 0
while x != len(message):
encrypt[x] = chr(encrypt[x])
x=x+1
名单如下:
encrypt = [10, 20, 30, 40, 50]
你可以这样写:
encrypt = [chr(encrypt[i]) for i in range(len(message))]
但这不是答案。你能给我们原始的加密列表吗?