List and order

Nic nospam at nospam.nospam
Mon May 15 08:23:32 EDT 2006


Hello Miki,

Many thanks for the support.
I tried to insert and execute the code, but the following error happens:

Traceback (most recent call last):
  File "grafodna.py", line 10, in ?
    edges.sort(key = lambda u, v: (ddeg(u), ddeg(v)))
TypeError: <lambda>() takes exactly 2 arguments (1 given)

Do you know how is it possible to delete it?
Thanks.

Nic

"Miki" <miki.tebeka at gmail.com> ha scritto nel messaggio 
news:1147691967.998184.285120 at u72g2000cwu.googlegroups.com...
> Hello Nic,
>
> Python lists has a very powerfull buid-in "sort".
>
> edges = list(G.edges())
> edges.sort(key = lambda u, v: (ddeg(u), ddeg(v)))
> for u, v in edges:
>    print u,v,  # Note the training comma to avoid newline
> print
>
> HTH,
> Miki
> http://pythonwise.blogspot.com
> 





More information about the Python-list mailing list