fork(1) download
  1. yourlist = [ 'Item_has_was_updated_May_2010',
  2. 'Item_updated_Apr_2011',
  3. 'Item_got_updated_Sept_2011']
  4.  
  5. x = 'foo'
  6. y = 'bar'
  7.  
  8. yourlist = [s.rsplit('_', 2)[0] + '_' + x + '_' + y for s in yourlist]
  9.  
  10. print yourlist
Success #stdin #stdout 0.02s 4676KB
stdin
Standard input is empty
stdout
['Item_has_was_updated_foo_bar', 'Item_updated_foo_bar', 'Item_got_updated_foo_bar']