Pythonの小数点:eの使い方
Pythonではeの後にマイナスをつけて0.1倍、0.01倍…を表します。
n_0 = 1.23e-0
n_1 = 1.23e-1
n_2 = 1.23e-2
n_3 = 1.23e-3
n_4 = 1.23e-4
print(n_0)
print(n_1)
print(n_2)
print(n_3)
print(n_4)
出力:
1.23
0.123
0.0123
0.00123
0.000123
最初の例にあるようにe-0は1倍を表します。
文字列
-
Pythonの小数点:eの使い方094
-
Pythonの文字列を連結する方法0785
-
Pythonの文字列はリストのように一文字ずつ取得できる023223
-
文字列をsplitで分割してリストにする|Python01230
-
Pythonの文字列を結合する(join)01130
-
Pythonで文字列を置換する(replace)0421
-
Pythonでランダム文字列を作る0382