Sion Arrowsmith [EMAIL PROTECTED] wrote:
special_dragonfly [EMAIL PROTECTED] wrote:
if key in FieldsDictionary:
FieldsDictionary[key].append(FieldClass(*line.split(,)))
else:
FieldsDictionary[key]=[FieldClass(*line.split(,))]
These four lines can be
Hello,
I'm new to this group, I've read through the subject of a lot of the group
but can't find anything relevant. Perhaps my question is too basic but I'm
still stuck.
Classes and Dictionaries.
If I have a dictionary, how do I instantiate many instances of a class per
dictionary key? Either at
special_dragonfly wrote:
I'm new to this group, I've read through the subject of a lot of the group
but can't find anything relevant. Perhaps my question is too basic but I'm
still stuck.
Classes and Dictionaries.
If I have a dictionary, how do I instantiate many instances of a class per
special_dragonfly [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hello,
I'm new to this group, I've read through the subject of a lot of the group
but can't find anything relevant. Perhaps my question is too basic but I'm
still stuck.
Classes and Dictionaries.
If I have a
special_dragonfly wrote:
I've managed to solve the problem, I really was just being a
dunce. Here's how incase anyone is wondering:
class MyClass:
def __init__(self):
name=
dict={}
dict[0]=[]
dict[0].append(MyClass())
dict[0][0].name=Hello
print dict[0][0].name
I'm
special_dragonfly a écrit :
(snip)
I've managed to solve the problem, I really was just being a dunce. Here's
how incase anyone is wondering:
class MyClass:
def __init__(self):
name=
dict={}
dict[0]=[]
dict[0].append(MyClass())
dict[0][0].name=Hello
print dict[0][0].name
Bruno Desthuilliers [EMAIL PROTECTED]
wrote in message news:[EMAIL PROTECTED]
special_dragonfly a écrit :
(snip)
I've managed to solve the problem, I really was just being a dunce.
Here's how incase anyone is wondering:
class MyClass:
def __init__(self):
name=
dict={}
special_dragonfly [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Bruno Desthuilliers [EMAIL PROTECTED]
wrote in message news:[EMAIL PROTECTED]
special_dragonfly a écrit :
(snip)
I've managed to solve the problem, I really was just being a dunce.
Here's how incase anyone is
On 2007-08-09, special_dragonfly [EMAIL PROTECTED] wrote:
Is there anyway for python to consider the values within a
string when entering the data into a dictionary. I know that
isn't very clear so here's an example:
class MyClass(object):
def __init__(self,name=,age=):
special_dragonfly wrote:
special_dragonfly [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Bruno Desthuilliers [EMAIL PROTECTED]
wrote in message news:[EMAIL PROTECTED]
special_dragonfly a écrit :
(snip)
I've managed to solve the problem, I really was just being a dunce.
special_dragonfly [EMAIL PROTECTED] writes:
I've managed to solve the problem, I really was just being a
dunce.
Doubtful; but at this stage we can't tell, because we still don't know
what it is you're actually trying to *do*.
Here's how incase anyone is wondering:
class MyClass:
def
Neil Cerutti a écrit :
On 2007-08-09, special_dragonfly [EMAIL PROTECTED] wrote:
Is there anyway for python to consider the values within a
string when entering the data into a dictionary. I know that
isn't very clear so here's an example:
class MyClass(object):
def
On 2007-08-09, Bruno Desthuilliers [EMAIL PROTECTED] wrote:
Neil Cerutti a écrit :
On 2007-08-09, special_dragonfly [EMAIL PROTECTED] wrote:
Is there anyway for python to consider the values within a
string when entering the data into a dictionary. I know that
isn't very clear so here's an
special_dragonfly a écrit :
Bruno Desthuilliers [EMAIL PROTECTED]
wrote in message news:[EMAIL PROTECTED]
special_dragonfly a écrit :
(snip)
(and resnip)
Hello
To answer first Bjoern:
I have a dictionary and a class. The dictionary needs to be filled with
multiple instances of the
Ben Finney [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
special_dragonfly [EMAIL PROTECTED] writes:
I've managed to solve the problem, I really was just being a
dunce.
Doubtful; but at this stage we can't tell, because we still don't know
what it is you're actually trying to
Neil Cerutti a écrit :
On 2007-08-09, Bruno Desthuilliers [EMAIL PROTECTED] wrote:
Neil Cerutti a écrit :
On 2007-08-09, special_dragonfly [EMAIL PROTECTED] wrote:
Is there anyway for python to consider the values within a
string when entering the data into a dictionary. I know that
isn't
special_dragonfly [EMAIL PROTECTED] wrote:
if key in FieldsDictionary:
FieldsDictionary[key].append(FieldClass(*line.split(,)))
else:
FieldsDictionary[key]=[FieldClass(*line.split(,))]
These four lines can be replaced by:
FieldsDictionary.setdefault(key,
special_dragonfly a écrit :
Ben Finney [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
special_dragonfly [EMAIL PROTECTED] writes:
I've managed to solve the problem, I really was just being a
dunce.
Doubtful; but at this stage we can't tell, because we still don't know
what it
18 matches
Mail list logo