I\'m looking for the opposite to this Q&A: Convert an excel or spreadsheet column letter to its number in Pythonic fashion.
or this one but in python How to conv
My recipe for this was inspired by another answer on arbitrary base conversion (https://stackoverflow.com/a/24763277/3163607)
import string
def n2a(n,b=string.ascii_uppercase):
d, m = divmod(n,len(b))
return n2a(d-1,b)+b[m] if d else b[m]
Example:
for i in range(23,30):
print (i,n2a(i))
outputs
23 X
24 Y
25 Z
26 AA
27 AB
28 AC
29 AD