📌  相关文章
📜  将浮点数转换为字符串时的格式 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:01.984000             🧑  作者: Mango

代码示例1
# Option one
older_method_string = "%.9f" % numvar
# Option two, preferred in Python 3
newer_method_string = "{:.9f}".format(numvar)
# Option 3 (versions 3.6 and higher)
newest_method_string = f"{numvar:.9f}"