aa = (1, 2, 3, 4, 5, 6)
b = [(x == 5 and 8 or x) for x in aa]

z = map(lambda x: 8 if x == 5 else x, [i for i in b])

print(b)
print(z)

 

相关文章:

  • 2022-12-23
  • 2022-01-03
  • 2022-12-23
  • 2021-10-26
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
猜你喜欢
  • 2022-12-23
  • 2021-09-27
  • 2021-05-22
  • 2021-06-27
  • 2022-02-09
相关资源
相似解决方案