代码:
print("商品总金额:"+(money_all))
报错:
TypeError: can only concatenate str (not "float") to str
原因:
print()中的‘+’号具有拼接作用,参与’+'的参数的数据类型需保持一致
修改后代码:
print("商品总金额:"+str(money_all))
或
代码:
print("商品总金额:"+(money_all))
报错:
TypeError: can only concatenate str (not "float") to str
原因:
print()中的‘+’号具有拼接作用,参与’+'的参数的数据类型需保持一致
修改后代码:
print("商品总金额:"+str(money_all))
或