python - Receiving the error ValueError: chr() arg not in range(256) -


elif chosena == 2: print('''you have chosen decrypt message,''') print("please enter name of file wish decrypt") = raw_input() open(a + '.txt') text:     lar = text.read()     print(lar) ms = 0 print("oi drongo enter ya key") b = raw_input()  c in b:     f = ord(c)     ms = ms + f geek = (ms / 8) - 32 #print(geek)  nlar = ''  c  in lar:     g = ord(c)     if g > 126:         g -= 94     g -= geek     f = unichr(g)     print(f) 

during "for c in lar:" trying characters in file converted ascii values using ord() , if greater 126 (the alphabet) remove 94 value take geek(the offset factor generated 8 character key) away ascii value returned text encrypted, if want full code , i'll provide if help.


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -