Convert numbers into corresponding letter using Python

user3556962 picture user3556962 · Apr 21, 2014 · Viewed 46.9k times · Source

I was wondering if it is possible to convert numbers into their corresponding alphabetical value. So

1 -> a
2 -> b

I was planning to make a program which lists all the alphabetical combinations possible for a length specified by a user.

See I know how to build the rest of the program except this! Any help would be wonderful.

Answer

LinconFive picture LinconFive · Sep 25, 2017

Big Letter:

chr(ord('@')+number)

1 -> A

2 -> B

...

Small Letter:

chr(ord('`')+number)

1 -> a

2 -> b

...