Python 內建函數
把數字 5 轉換為浮點數:
x = float(5)
運行實例
float() 把指定值轉換為浮點數。
float(value)
把字符串轉換為浮點數:
x = float("3.1415")