utf - string translation

Frederic Rentsch anthra.norell at vtxmail.ch
Wed Nov 29 12:05:36 CET 2006

Dan wrote:
> On 22 nov, 22:59, "John Machin" <sjmac... at lexicon.net> wrote:
>>> processes (Vigenère)
>> So why do you want to strip off accents? The history of communication
>> has several examples of significant difference in meaning caused by
>> minute differences in punctuation or accents including one of which you
>> may have heard: a will that could be read (in part) as either "a chacun
>> d'eux million francs" or "a chacun deux million francs" with the
>> remainder to a 3rd party.
> of course.
> My purpose is not doing something realistic on a cryptographic view.
> It's for learning rudiments of programming.
> In fact, coding characters is a kind of cryptography I mean, sometimes,
> when friends can't read an email because of the characters used...
> I wanted to strip off accents because I use the frequences of the
> charactacters. If  I only have 26 char, it's more easy to analyse (the
> text can be shorter for example)
Try this:

from_characters   = 
to_characters     = 
translation_table = string.maketrans (from_characters, to_characters)
translated_string = string.translate (original_string, translation_table)


More information about the Python-list mailing list