若有帮助,望采纳~try:str1 = '123123.123'if type(str1) is str:print(eval(str1), '是数字字符串')else:print('不是字符串')except NameError:print('不是数字字符串')
str1 = str1.replace(',','') if str1.isnumeric(): print(str1) else: print('非数字字串')