Re: nested tuple slice

2005-04-12 Thread Brian van den Broek
dimitri pater said unto the world upon 2005-04-12 17:49: hello! I want to change a nested tuple like: tuple = (('goat', 90, 100), ('cat', 80, 80), ('platypus', 60, 800)) into: tuple = (('goat', 90), ('cat', 80), ('platypus', 60)) in other words, slice the first elements of every index Any ideas on

Re: nested tuple slice

2005-04-12 Thread dimitri pater
Thanks, I have been trying this: tuple = (('goat', 90, 100), ('cat', 80, 80), ('platypus', 60, 800)) index = 0 newtuple = () for item in tuple:     newtuple = newtuple + tuple[index][0:2]     index += 1     print newtuple but it returns: ('goat', 90, 'cat', 80, 'platypus', 60) which is no longer

RE: nested tuple slice

2005-04-12 Thread Leeds, Mark
maybe list(tuple)[0:2])) will get you what you want  but I don’t know how to change it back to a tuple. I’m just starting out but I would be interested also.       mark   -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of d