gpt4 book ai didi

python - 显示金额 - Python

转载 作者:行者123 更新时间:2023-12-01 04:49:05 24 4
gpt4 key购买 nike

print("The cost of paint based on whole gallons is: $", round(paint_costs,2))
The cost of paint based on whole gallons is: $ XXX.XX

如何省略 $ 和金额之间的空格,使其显示为:

The cost of paint based on whole gallons is: $XXX.XX

import.locale吗? ?

最佳答案

在打印函数中添加 sep="" 参数。

print("The cost of paint based on whole gallons is: $", round(paint_costs,2), sep="")

关于python - 显示金额 - Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28782281/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com