LoginSignup
0
3

More than 5 years have passed since last update.

指数表記を文字列型の読みやすい形に変換

Posted at

概要

たとえば、4 / 100000を計算した時に、0.00004として結果を見たいが、4e-05となる時がある。文字列型で0.00004にする方法。

>>> 4 / 100000
4e-05

方法

format()を使い、桁数を指定する。

>>> "{:.5f}".format(f)
'0.00004'

参考

0
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
3