How to convert a list of ASCII values to a string in Python

2 Answers

0 votes
lst = [97, 98, 99, 100, 101, 102]

s = ''.join(chr(i) for i in lst)

print(s)


 
 
 
'''
run:
 
abcdef

'''

 



answered Mar 17, 2023 by avibootz
0 votes
lst = [97, 98, 99, 100, 101, 102]

s = ''.join(map(chr, lst))

print(s)


 
 
 
'''
run:
 
abcdef

'''

 



answered Mar 17, 2023 by avibootz
...