使用一個包裝器(wrapper),讓bc用起來更加順手。
#!/usr/bin/env bash # 設置指定/默認精度 if [ "$1" = "-p" ]; then precision=$2 shift 2 else # 默認精度 precision=2 fi bc -q << EOF scale=$precision $* quit EOF exit 0
使用一個包裝器(wrapper),讓bc用起來更加順手。
#!/usr/bin/env bash # 設置指定/默認精度 if [ "$1" = "-p" ]; then precision=$2 shift 2 else # 默認精度 precision=2 fi bc -q << EOF scale=$precision $* quit EOF exit 0
def ADD(a): print(3,a,hex(id(a))) a.remove(2) print(3,a,hex(id(a))) a=a.append(10)