| 
 | 
 
 
发表于 2015-8-13 21:54:37
|
显示全部楼层
 
 
 
兄弟,你的非数字输出有点问题呀 
>>>  
----------------实现判断键盘输入的是整数还是浮点数程序---------------- 
少侠,请从键盘上任意输入一个数字吧: 215 
少侠,你输入的是个整数:  
 215 ,对不对?! 
少侠,请从键盘上任意输入一个数字吧: 不 
Traceback (most recent call last): 
 
  File "C:/Users/Administrator/Desktop/Python/代码/实现判断键盘输入的是整数还是浮点数程序-.py", line 9, in <module> 
    print("少侠,你输入的是个整数: ",int(temp),",对不对?!") 
ValueError: invalid literal for int() with base 10: '不' 
>>> 士大夫 
Traceback (most recent call last): 
 
  File "<pyshell#0>", line 1, in <module> 
    士大夫 
NameError: name '士大夫' is not defined 
>>>  |   
 
 
 
 |