<不支持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'的更多相关文章

  1. 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 ...

  2. input()报错:TypeError: '>=' not supported between instances of 'str' and 'int'

    今天学习python基础—分支与循环,接触到了if.在练习一个if语句的时候,出现了错误. 题目是: 根据分数划分成四个级别:优秀.良好.及格.不及格,分数是72: grade = 72if grad ...

  3. python的强制转换(当出现 not supported between instances of 'str' and 'int' 的错误时)

    当我们编程时,有时会出现如下错误:TypeError: '>' not supported between instances of 'str' and 'int' 如下图: 这是因为input ...

  4. python报错:not supported between instances of 'str' and 'int'

    not supported between instances of 'str' and 'int' : 意思就是字符串不能和int类型的数值比较

  5. 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, ...

  6. 关于TypeError: strptime() argument 1 must be str, not bytes解析

    关于TypeError: strptime() argument 1 must be str, not bytes解析   在使用datetime.strptime(s,fmt)来输出结果日期结果时, ...

  7. 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 ...

  8. python产生错误:can only concatenate str (not "int") to str

    代码为: #!/usr/bin/python # _*_ coding:utf-8_*_ # print("hello world!") name = input("na ...

  9. 刨根问底儿 -- intVal($str) 跟 (int) $str 的运算结果有什么区别

    intVal($str) 跟 (int) $str 都是把其他类型的变量转化为int型变量的方式,这么多年来我一直森森滴怀疑它们的运算结果在某些条件下会有区别.对于我的疑问,文档里也没有多说(或者我没 ...

随机推荐

  1. linux——实际工作中如何使用linux

    实际工作中,linux系统都不会在我们自己的电脑上,linux系统安装在机房的服务器上,我们操作linux不可能跑到机房去,所以我们需要有一个工具,能在公司通过网络远程连接到机房的linux服务器上 ...

  2. okhttp任务调度核心类dispatcher解析

    在之前已经对okhttp的同步和异步请求的流程进行了详细的分析,其中任务调度是由dispatcher来实现的,非常重要,所以这次专门来对它进行一个了解,带着问题去进行探究: Q1:okhttp如何实现 ...

  3. P1231 教辅的组成 拆点限流

    如果只有两个物品的话 是一个裸的二分图匹配问题 现在变成了三个物品之间的匹配 则只要在中间加一层节点表示书 再把这层的每个点拆成两个点中间连一条边限制流量 使其只能用一次 #include<io ...

  4. 如何处理请求返回的二进制数据流转化成xlsx文件?

    /* fileName : 文件名 res:二进制流 */ function getOutExcel(fileName, res) { let blob = new Blob([res], { typ ...

  5. Sleep-Join方法理解

    package cn.mayday.test; public class JoinTest { public static void main(String[] args) { try { int c ...

  6. python_列表方法

    1.在列表后面追加元素 user = [] while True: name = input("输入名字:") # 在列表后面追加元素 user.append(name) prin ...

  7. luogu 2982 [USACO10FEB]慢下来Slowing down dfs序+树状数组

    将要查询的信息放到 dfs 序上并用树状数组查一个前缀和即可. #include <bits/stdc++.h> #define N 100004 #define setIO(s) fre ...

  8. luogu 4047 [JSOI2010]部落划分 最小生成树

    最小生成树或者二分都行,但是最小生成树会好写一些~ Code: #include <bits/stdc++.h> #define ll long long #define N 100000 ...

  9. hive-server 启动失败问题小记

    Unable to instantiate using constructor(MetricRegistry, HiveC onf) for reporter org.apache.hadoop.hi ...

  10. javascript数据结构之单链表

    下面是用javascript实现的单链表,但是在输出的时候insert方法中存在问题,chrome的console报错说不能读取空的属性,调试了很久都没有通过,先在这里存着,以后再来修改一下. //数 ...