chars = [chr(i) for i in range(ord('A'), ord('Z')+1)] s = 'abc' for x in s: print chars.index(x.upper())+1