Drkcore

01 03 2017 Python Tweet

pythonのformatでfloatの正負の記号を無視して揃える

ドットの前にスペース入れるらしい。解決するのに大分かかったのでメモ

>>> print "{:.1f}\n{:.1f}".format(1.0, -1.0)
1.0
-1.0
>>> print "{: .1f}\n{: .1f}".format(1.0, -1.0)
 1.0
-1.0

About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021