Anthony D'Agostino, this is my first raw version, it can fail in lots of ways depending on your input list l (and surely there are better ways to do it), but it's a start:
. l = [('A','Y'), ('J','A'), ('Y','J')]
. pairs = dict(l)
. result = []
. key = pairs.iterkeys().next()
. while pairs:
. val = pairs.pop(key)
. result.append( (key, val) )
. key = val
. print result
Bear hugs,
Bearophie
--
http://mail.python.org/mailman/listinfo/python-list
