"John" <[EMAIL PROTECTED]> wrote

>    a=(struct.unpack(ft,f2.read(struct.calcsize(ft))) for ft in Dfmt)
>    for ln in a: print ln
>
> Which gives me:
>
> /cygdrive/c/washakie/binfile has been opened
> (21, 20060612, 0)
> ('Version 4.3',)
> (21, 12, -86400, -86400, -900, 12, 24)
>
> however, how can I now assign variables based on the 'generator 
> object' a?
> What exactly is this? When I try to do something like:
>
> My question is, how can I now work with 'a' so that i can use the 
> values?

You akready have in your for loop.
You printed the values. There is nothing to stop you assigning
them to variables. You will need to figure out what each line
contains (which line you are on) and unpack the values from the
tuples.

Alternatively put them into a list:

values = [ln for ln in a]

Now you can use indexing:

theDate = values[1][1]

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to