fork download
  1. alist = [[1,2,3], [4,5,6], [7,8,9]]
  2. blist = [['a','b','c'], ['d','e','f'], ['g','h','i']]
  3. item = 1
  4. z = [(i, x.index(item)) for i, x in enumerate(alist) if item in x][0]
  5. alist[z[0]][z[1]] = blist[z[0]][z[1]]
  6. print alist
  7.  
Success #stdin #stdout 0.01s 6356KB
stdin
Standard input is empty
stdout
[['a', 2, 3], [4, 5, 6], [7, 8, 9]]