python3中,字符串如何转化为数字,不区分整数还是浮点数?

2024-11-02 18:21:32
推荐回答(1个)
回答1:

c=float(a)+float(b)
if int(c) == c:
print(int(c))
print(c)