TypeError: '<' not supported between instances of 'str' and 'int'
<不支持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后')
TypeError: '<' not supported between instances of 'str' and 'int'的更多相关文章
- Python报错TypeError: '<' not supported between instances of 'str' and 'int'
n = input() if n>=100:print(int(n)/10) else:print(int(n)*10) 报错内容: Traceback (most recent call la ...
- input()报错:TypeError: '>=' not supported between instances of 'str' and 'int'
今天学习python基础—分支与循环,接触到了if.在练习一个if语句的时候,出现了错误. 题目是: 根据分数划分成四个级别:优秀.良好.及格.不及格,分数是72: grade = 72if grad ...
- python的强制转换(当出现 not supported between instances of 'str' and 'int' 的错误时)
当我们编程时,有时会出现如下错误:TypeError: '>' not supported between instances of 'str' and 'int' 如下图: 这是因为input ...
- python报错:not supported between instances of 'str' and 'int'
not supported between instances of 'str' and 'int' : 意思就是字符串不能和int类型的数值比较
- TypeError: sequence item 1: expected str instance, int found
Error Msg Traceback (most recent call last): File "E:/code/adva_code/my_orm.py", line 108, ...
- 关于TypeError: strptime() argument 1 must be str, not bytes解析
关于TypeError: strptime() argument 1 must be str, not bytes解析 在使用datetime.strptime(s,fmt)来输出结果日期结果时, ...
- Python之scrapy框架之post传输数据错误:TypeError: to_bytes must receive a unicode, str or bytes object, got int
错误名:TypeError: to_bytes must receive a unicode, str or bytes object, got int 错误翻译:类型错误:to_bytes必须接收u ...
- python产生错误:can only concatenate str (not "int") to str
代码为: #!/usr/bin/python # _*_ coding:utf-8_*_ # print("hello world!") name = input("na ...
- 刨根问底儿 -- intVal($str) 跟 (int) $str 的运算结果有什么区别
intVal($str) 跟 (int) $str 都是把其他类型的变量转化为int型变量的方式,这么多年来我一直森森滴怀疑它们的运算结果在某些条件下会有区别.对于我的疑问,文档里也没有多说(或者我没 ...
随机推荐
- js获取div基础元素
1.js获取div元素 clientHeight 获取对象的高度,不计算任何边距.边框.滚动条,但包括该对象的补白. clientLeft 获取 offsetLeft 属性和客户区域的实际左边之间的距 ...
- kotlin字符串模板&条件控制
字符串模版: 小时候都有要求记日记的习惯,下面是一小学生记的日记: 很漂亮的流水账,那细分析一下这些文件其实大体都类似,只有几个不同点: 其实就是地点变了,那对于这种有规律的文字可以采用kotlin的 ...
- Python&Selenium 关键字驱动测试框架之数据文件解析
摘要:在关键字驱动测试框架中,除了PO模式以及一些常规Action的封装外,一个很重要的内容就是读写EXCEL,在团队中如何让不会写代码的人也可以进行自动化测试? 我们可以将自动化测试用例按一定的规格 ...
- golang 中Pointers Vs References
原文: https://spf13.com/post/go-pointers-vs-references/ Pointers Vs References Some languages includin ...
- C# 动态语言扩展(11)
在 C# 4 开始添加 dynamic 类型.Mono C# 已经支持 C# 6.0 了. DLR C# 4 动态功能是 Dynamic Language Runtime (动态语言运行时,DLR)的 ...
- maven热部署插件-jetty
作者:小勇Oo 关于maven-jetty-plugin的说明: pom文件中: <build> <finalName>freemarker</finalName> ...
- 03 Vue -课程详细(传参id)、图片显示、推荐课程(主动重定向)
1.CourseDetail 课程详细信息 1.如何传入参数id (1)router中导入 (2) router-link 关联子组件 (3)detail.vue接受id (4)通过id查询详细 ...
- ES集群安装
环境配置 安装openjdk(依赖) -openjdk.x86_64 安装elasticsearch yum -y install elasticsearch 配置 /etc/elasticsearc ...
- 图像的padding操作
为了完成卷积后图像大小不变,原始图像需要进行边界填充 copyMakeBorder(src,dst,top,bottom,left,right,bordertype,value); bordertyp ...
- offset([coordinates])
offset([coordinates]) 概述 获取匹配元素在当前视口的相对偏移. 返回的对象包含两个整型属性:top 和 left,以像素计.此方法只对可见元素有效.大理石平台价格表 参数 coo ...