我试图运行下面的代码,它是一个Bash脚本。Bash:使用Python函数Ceil - 如何做两个变量的乘积ceil?
NUMBER=600
LOSS_RATE=0,3
TOT_PKT=100
test=$(python -c "from math import ceil; print ceil($NUMBER * 500.0)")
test2=$(python -c "from math import ceil; print ceil($NUMBER * $LOSS_RATE)")
echo $test
echo $test2
我得到以下打印出来:执行
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: ceil() takes exactly one argument (2 given)
300000.0
第一Python的命令,但在第二使给定的类型错误。我该如何解决这个问题?
LOSS_RATE = 0.3不是0,3 – Sharun