On 25 March 2011 13:51, scattered <tooscatte...@gmail.com> wrote: > Here is another possibility: you are using Python *interactively* in > solving cryptograms (as a matter of fact - I was doing exactly this > yesterday in trying to solve some Playfair ciphers). You have a > ciphertext that is a stream of letters in the range A...Z. You need to > consult frequencies of letters, pairs of letters, triples of letters, > and quadruples of letters that occur. So, you write a script that > steps through the cipher text, creates a dictionary which records > frequencies of strings of length <= 4, and, as an added convienence, > creates bindings of frequencies to these strings. Thus - if you want > to know how often, say, EFW occurs in the ciphertext you just type EFW > (rather than freq["EFW"])
And what happens when you want to know the frequency of "if", "def", "for" or any other variable which matches a keyword? Tim -- http://mail.python.org/mailman/listinfo/python-list