How to shift all characters in a string N places up in the ASCII table with Python

1 Answer

0 votes
def shiftUpNCharacters(s, N):
    return ''.join(chr(ord(char) + N) for char in s)
    
 
print(shiftUpNCharacters("4abc", 3))



'''
run:

7def

'''

 



answered Feb 29, 2024 by avibootz
...