A
Andrew
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 __init__(self):
for letter in ascii_lowercase:
setattr(self,letter,0)
Is there a way I can do something like this without using classes?
Thanks
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 __init__(self):
for letter in ascii_lowercase:
setattr(self,letter,0)
Is there a way I can do something like this without using classes?
Thanks