Normally, Just ord and add 2 and chr back, (Y, Z will give you unexpected result ("[","")
>>> chr(ord("A")+2) 'C' If you want to change Y, Z to A, B, you could do like this.
>>> chr((ord("A")-0x41+2)%26+0x41) 'C' >>> chr((ord("Y")-0x41+2)%26+0x41) 'A' >>> chr((ord("Z")-0x41+2)%26+0x41) 'B' Here is A to Z
>>> [chr((i-0x41+2)%26+0x41) for i in range(0x41,0x41+26)] ['C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'A', 'B']