Hello,

 : Maybe a bit confusing topic title, probably the example will do.
 : 
 : I have a tuple:
 : t = ('a', 'b', 'c', 'd')
 : And need the following output, list or tuple, doesn't matter:
 : (0, 'a', 1, 'b', 2, 'c', 3, 'd')
 : 
 : I tried with zip(), but get a list of tuples, which isn't the desired
 : output. Anyone with a solution or push in the right direction?

Perhaps you did not know about enumerate?

  t = ('a', 'b', 'c', 'd')
  l = list()
  for x in enumerate(t):
      l.extend(x)

-Martin

-- 
Martin A. Brown
http://linux-ip.net/
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to