<不支持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. mailx使用465端口发邮件

    centos上mailx通过465端口发送邮件   最近在看zabbix发送邮件的时候,发现自己的邮件总是无法发送,这里可能是外网防火墙禁止25端口,那么如何绕过25端口呢?  我使用的是163邮箱的 ...

  2. P5357 【模板】AC自动机(二次加强版)

    思路 这题可以同时作为AC自动机和SAM的模板啊喂 AC自动机 对T建出AC自动机,把S在上面匹配,然后记录每个点被经过的次数,最后统计一次即可(暴力跳fail的复杂度是不对的) SAM 对S建出SA ...

  3. MyBatis中#{}和${}的不同和${}的妙用(转)

        突然意识到sql语句的独特语义要和代码分离,我们就不能够在代码中写sql语句!!比如我要用${}在MyBatis的sql中拼接排序类型的时候,我就不能够在Java代码中直接写参数字符串为Ord ...

  4. CloseableHttpClient设置超时

    Java开发我们常常需要和第三方系统进行通信,通信的方式有多种,如dubbo方式,webservice,微服务和CloseableHttpClient等方式,常涉及到超时问题,这里主要说的是Close ...

  5. 11 git第二部分(未完成)

    https://www.cnblogs.com/shangchunhong/p/9444335.html

  6. 编译vim8

    1.获取最新的vim源码 $ wget https://codeload.github.com/vim/vim/tar.gz/v8.1.2256 2.解压缩 $ tar -xvzf vim-8.1.2 ...

  7. 阿里OSS Vue上传文件提示The OSS Access Key Id you provided does not exist in our records.解决方法

    vue项目 1.安装OSS的Node SDK npm install ali-oss --save 2.参考官方提示https://help.aliyun.com/document_detail/11 ...

  8. yii安装redis扩展(Windows)

    yii安装redis扩展可以用不同的方式, 最简单便捷的是使用 composer 方式, 有的时候composer会出现一些问题(现在还弄不懂),可能是网络什么的原因吧~ 还可以使用手动安装的方式, ...

  9. 和PHP相关的Linux命令

    Linux服务器上怎么找到php.ini php -ini #输出一堆信息,里面有loaded configuration file => /etc/php/7.0/cli/php.ini就是了 ...

  10. vue-cli3构建多页面应用

    创建一个项目hello-world vue create hello-worldcd hello-worldnpm run serve 在src目录下新建pages目录,在pages下新建页面 App ...