Replace one element of a tuple

Captain Dondo yan at NsOeSiPnAeMr.com
Thu Jun 1 17:04:40 EDT 2006


I have an array(?) (sorry, I'm new* to python so I'm probably mangling 
the terminology) that looks like this:

[((1028L, datetime.datetime(2006, 5, 30, 7, 0), datetime.datetime(2006, 
5, 30, 7, 30), 'Arthur', 'Prunella Sees the Light; Return of the 
Snowball', 'Prunella prepares for a sleepover with Marina; D.W. protects 
a snowball.', 'Children', 'tooth.seiner.lan', None, 0L, None, 1L, 1L, 
'Default', 9L, 'SH044107', 'EP0441070123', datetime.datetime(2006, 5, 
30, 7, 31, 24), 1164179392L, 0.0, 1, datetime.date(2002, 11, 28), 0, 0L, 
0),), ((1028L, datetime.datetime(2006, 5, 4, 10, 0), 
datetime.datetime(2006, 5, 4, 10, 30), 'Bob the Builder', 'Using Clues', 
'', 'Children', 'tooth.seiner.lan', None, 0L, None, 1L, 1L, 'Default', 
6L, 'SH326087', 'EP3260870141', datetime.datetime(2006, 5, 4, 10, 31, 
30), 1163673536L, 0.0, 1, datetime.date(2005, 3, 19), 0, 0L, 0),)]

I want to replace every instance of 'tooth.seiner.lan' with 'localhost'. 
  There may be lots and lots of these entries (they're pulled from my 
mythtv database).

I could brute-force this by rewriting the whole thing and replacing 
every 9th element but there has to be a better way....

I've looked at various search-and-replace snippets but none that address 
what I am trying to do....

--Yan

*I'm not really new to python, just very very rusty.  Last time I used 
it was about 3 years ago, and I was equally clueless....



More information about the Python-list mailing list