On 5/6/07, Jouni K. Seppänen <[EMAIL PROTECTED]> wrote:
> Tommy Grav <[EMAIL PROTECTED]> writes:
>
> > I would now like to plot a vs e for all the obj objects in nlist.
> > how do I do that? I tried
> >
> > plot(nlist[:].a,nlist[:].e,'ko')
>
> You have a list of objects that have attributes named a
Tommy Grav <[EMAIL PROTECTED]> writes:
> I would now like to plot a vs e for all the obj objects in nlist.
> how do I do that? I tried
>
> plot(nlist[:].a,nlist[:].e,'ko')
You have a list of objects that have attributes named a and e; these
are not attributes of the list. Try
plot([x.a for x i
Hello Tommy,
I would like to do such convertings, too, but I think there is no such fast
way in python. I'm using the 'for statement' to iterate over a list of
objects and save their properties into a new list.
best regards,
Matthias
On Friday 04 May 2007 17:54, Tommy Grav wrote:
> I have som
I have some code that simplified looks like this:
class cKBO(object):
def __init__(cls):
cls.a = 0.
cls.e = 0.
lines = open("test.file","r").readlines()
nlist = []
for line in lines:
obj = cKBO()
(a,e) = line.split
obj.a = float(a)