這是我的一些Python代碼:如何刪除python中的額外空間?
my_fancy_variable = input('Choose a color to paint the wall:\n')
if my_fancy_variable == 'red':
print(('Cost of purchasing red paint:\n$'),math.ceil(paint_needed) * 35)
elif my_fancy_variable == 'blue':
print(('Cost of purchasing blue paint:\n$'),math.ceil(paint_needed) * 25)
elif my_fancy_variable == 'green':
print(('Cost of purchasing green paint:\n$'),math.ceil(paint_needed) * 23)
我只是想擺脫「$」之間的空間和「105
有更多的代碼,但基本上我會得到一個結果: Cost of purchasing red paint: $ 105
感謝
@CaptainTrunky這個問題涉及到Python 2 –