two little syntax questions

Marcus Stojek stojek at part-gmbh.de
Thu Aug 30 08:39:09 EDT 2001


Hi,

Two little syntax questions:
1.-----------------------------
I have a huge dict of 3-tuples. I need the min and max value
of all tuple[0] entries.

I would like to use reduce. Something like:

nodes[1]=(3,2,5)
nodes[2]=(-1,2,9)
nodes[3]=(0,1,6)
nodes[4]=(2,9,1)

minx = reduce(lambda a,b:min(a,b),nodes???and now what)

how do I explain: take first entry in tuple for all keyvalues
2.------------------------------

I have to print the remaining entries of a list
(first entries are printed in groups of 8 per line)

lines = len(list)/8
rest = len(list)%8
print rest * "i," % (list[lines*8:])

doesn't work. Okay I know print is expecting a tuple and
list[lines*8:] is not. So how can I transform this into
a tuple.

Thanks a lot
Marcus










More information about the Python-list mailing list