log base 10 python code example Example 1: log2 in python math.log2(x) #x is a number Example 2: python log10 import math math.log10( x )