import codecs def etoa(input): ustring=codecs.decode(input,'cp500') return ustring input='öð÷ððô÷ððòòùðó^@^@^@^@^@^L^L^L^@^@^@^@^L@^@^L@@@^@^@^@^L^@^@^@^L^@^@^@^@^@^@^Lðññ@@@@@@@@@@@@@@@@@@@@@@@@@@@2^@<ððððð@@@@@@@@@@@@@@@^@^@^@^O@@@@@@@@@@@@@@@^R^P<80>^_^@^@^A^Y0L^@^@^O^@^@^O@@@@ñöðôðð' aostr=etoa(input.encode('latin-1')) print('output:',aostr)