1.这个只接受一个真正的数!!!!!

2.这样会报错TypeError: must be real number, not list

import math as ma

list1 = [1,1.2,3,4,5,6.7]
ma.ceil(list1)

3.办法:循环追加;

import math as ma

list1 = [1,1.2,3,4,5,6.7]

list2 = []
for i in list1:
    x = ma.ceil(i)
    list2.append(x)

print(list2)

#输出:[1, 2, 3, 4, 5, 7]

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-30
  • 2021-07-15
  • 2022-12-23
猜你喜欢
  • 2021-11-25
  • 2022-12-23
  • 2021-12-23
  • 2021-10-19
  • 2022-12-23
  • 2021-12-20
相关资源
相似解决方案