如何将列表转换为ASCII,但是我想在转换后再次拥有一个列表。
我发现这是将ASCII转换为列表的方法:
L = [104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100]
print(''.join(map(chr,L)))
但这并不能逆转。
这是我的输入:
L = ['h','e','l','l','o']
我希望将此作为输出:
L = ['104','101','108','108','111']
L = ['h','e','l','l','o']
print(list(map(str, map(ord, L))))
输出:
['104', '101', '108', '108', '111']
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句