Kent Johnson wrote:
> letters = {}
> for letter in ascii_lowercase:
> letters[letter] = 0
Or more simply:
letters = dict.fromkeys(ascii_lowercase, 0)
--
http://mail.python.org/mailman/listinfo/python-list
Andrew wrote:
> I'm writing a program that will take substitution and transposition
> cipher texts and spit out plain text with no human input. So I suppose
> I'll have dictionaries of digraphs and trigraphs too; for frequency
> analysis.
> Do you think this is to heavy of a project to learn the
Oops, I probably should have tried searching the list first. My
background is strictly academic. I was switching languages so often I
never got really familiar with any of them. Maybe C for a while, but
I've forgotten alot. I'm hoping python will be the last language I ever
need. :) I don't know wh
Andrew wrote:
> Newb here... For one of my programs I want to initialize a variable for
> each letter of the alphabet. For example, a,b,c = 0,0,0.
Why do you want to do this? This looks like a particularly bad idea to
me. Can't you just use a dict of the "variables", e.g.:
py> d = dict.fromkeys
Andrew wrote:
> Newb here... For one of my programs I want to initialize a variable for
> each letter of the alphabet. For example, a,b,c = 0,0,0. I don't think
> this works, but I'm wondering if I can do something similar to this:
>
> from string import ascii_lowercase
>
> class Blah:
> def