【发布时间】:2014-03-18 07:44:33
【问题描述】:
我有如下声明:
print ("You have entered the price of ",var1, "for a chocolate bar")
这很有效,但是我需要在它前面放一个“$”来输出。我尝试将它隐藏在 print 语句中,但是你最终会在它之间产生一个差距,所以你最终会得到
'You have entered the price of $ 34.33 for a chocolate bar'.
我需要它:
'You have entered the price of $34.33 for a chocolate bar'.
我对 python 很陌生,这让我很困惑。 任何帮助,将不胜感激。我正在使用 python 3.3.4
【问题讨论】:
标签: python