python当出现 not supported between instances of 'str' and 'int' 的处理方法
当我们编程时,有时会出现如下错误:TypeError: '>' not supported between instances of 'str' and 'int'
str : 字符串
int :整型
如下图:

这是因为input()返回的数据类型是str类型,不能直接和整数进行比较,必须先把str转换成整型,使用int()方法:age = int(input ("请输入你的年龄:"))
改正之后为:

 
                    
                     
                    
                 
                    
                 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号