import math math.log( x )
註:此函式無法直接存取,所以我們需要匯入 math 模組,然後用數學靜態物件呼叫這個函式。
x -- 這是一個數位表示式。
#!/usr/bin/python3 import math # This will import math module print ("math.log(100.12) : ", math.log(100.12)) print ("math.log(100.72) : ", math.log(100.72)) print ("math.log(math.pi) : ", math.log(math.pi))
math.log(100.12) : 4.6063694665635735 math.log(100.72) : 4.612344389736092 math.log(math.pi) : 1.1447298858494002