n = input() if n>=100:print(int(n)/10) else:print(int(n)*10) 报错内容: Traceback (most recent call last): File "1.py", line 12, in <module> if n>=100:print(int(n)/10) TypeError: '>=' not supported between instances of 'str' and 'int'…
not supported between instances of 'str' and 'int' : 意思就是字符串不能和int类型的数值比较…
今天学习python基础—分支与循环,接触到了if.在练习一个if语句的时候,出现了错误. 题目是: 根据分数划分成四个级别:优秀.良好.及格.不及格,分数是72: grade = 72if grade >= 90: print('优秀')elif grade >=70: print('良好')elif grade >=60: print('及格')else: print('不及格')   这种情况下没有报错,打印出:良好.     然后我就想换一种方法,把前几天学到的input也用进去…
当我们编程时,有时会出现如下错误:TypeError: '>' not supported between instances of 'str' and 'int' 如下图: 这是因为input()返回的数据类型是str类型,不能直接和整数进行比较,必须先把str转换成整型,使用int()方法:age = int(input ("请输入你的年龄:")) 改正之后为: 这样程序就达到了预期的效果了…
<不支持str实例和int实例之间的对比 birth是str类型 2000是int类型 所以无法对比,报错 birth = input('birth: ') if birth < 2000: print('00前') else: print('00后') 修改为: s = input('birth: ') birth = int(s) if birth < 2000: print('00前') else: print('00后')…
Python报错总结: 常见异常 1,NameError: name 'a' is not defined:未定义函数名             2,IndentationError: unindent does not match any outer indentation level :代码缩进问题 3,IndentationError: unexpected indent:代码缩进问题 4,TypeError: %d format: a number is required, not st…
Python报错module 'scipy.misc' has no attribute 'imresize' 解决办法: 安装Pillow包,命令如下: pip install Pillow 然后重启python环境 Python报错module 'scipy.misc' has no attribute 'imread' 解决办法: 大部分解决办法都是说没有安装PIL第三方库,库名现在为Pillow,推荐直接使用命令pip install Pillow进行安装,但是我的问题并没有因此得到解决…
selenium python 报错如下: raise exception_class(message, screen, stacktrace)selenium.common.exceptions.WebDriverException: Message: Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability…
解决Python报错:local variable 'xxx' referenced before assignment(引) 解决Python报错:local variable 'xxx' referenced before assignment(引)   这个问题很囧,在外面定义了一个变量 xxx ,然后在python的一个函数里面引用这个变量,并改变它的值,结果报错local variable 'xxx' referenced before assignment,代码如下: view pl…
如题:python 报错 提示为 : wxPyDeprecationWarning: Using deprecated class PySimpleApp. 解决:将 wx.PySimpleApp() 替换为 wx.App(False) 即可. 参考:http://stackoverflow.com/questions/15144168/error-using-deprecated-class-pysimpleapp-after-removing-epd…