fork download
  1. def numberfunction(s):
  2. if s == "":
  3. return 0
  4. if s < 0:
  5. return -1
  6. if s > 0:
  7. return s
  8.  
  9. from functools import partial
  10. a, x = [[1, 2, 3, ""], [-1, 1, -1, 1], [2, -2, -2, 2]], partial(map, numberfunction)
  11. print map(x, a)
  12.  
Success #stdin #stdout 0.01s 7852KB
stdin
Standard input is empty
stdout
[[1, 2, 3, 0], [-1, 1, -1, 1], [2, -1, -1, 2]]