我試圖對一個整數(shù)使用兩個格式說明符,但我不知道正確的語法。我想格式化一個大數(shù)字以使用逗號,并四舍五入到兩位小數(shù)。print('Total = ${0:,}{0:.2f}'.format(total))
#prints total once with commas, then prints total again with two decimal places but no commas.編寫打印命令的正確方法是什么,以便用逗號和兩個小數(shù)位打印一次總數(shù)?
添加回答
舉報
0/150
提交
取消