我是像这样写代码的:
import easygui
a = easygui.enterbox('give me a float number')
b = float(a)
easygui.msgbox("the number is" + b)
但运行后的结果是:
Traceback (most recent call last):
File "D:/Python27/My program/get a float number", line 4, in <module>**
easygui.msgbox("the number is" + c)
TypeError: cannot concatenate 'str' and 'float' objects**
请问正解应该是什么?
----------------------------------------豁然开朗的分割线------------------------------------------
已经知道了,应该是这样:
import easygui
number = float(easygui.enterbox('give me a float number'))
easygui.msgbox("the number is" + str(number))