1. 程序源代码报错部分:

#选择年级
if grade == '幼升小':
outline.nianji().pop(0).click()
elif grade == "一年级":
outline.nianji().pop(1).click() # 一年级
elif grade == "二年级":
outline.nianji().pop(2).click() # 二年级
elif grade == "三年级":
outline.nianji().pop(3).click() # 三年级
elif grade == "四年级":
outline.nianji().pop(4).click() # 四年级
elif grade == "五年级":
outline.nianji().pop(5).click() # 五年级 2.运行程序时的报错信息:

uncode编码警告:在unicode等价比较中,把两个参数同时转换为unicode编码失败。中断并认为他们不相等。

windows下的字符串str默认编码是ascii,而python编码是utf8



3. 解决办法:
在代码中加入如下:
import sys
reload(sys)
sys.setdefaultencoding('utf8')
 

python2.7运行报警告:UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal解决办法的更多相关文章

  1. python2.7运行出现的Warning: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal

    运行出现如下错误 uncode编码警告:在unicode等价比较中,把两个参数同时转换为unicode编码失败.中断并认为他们不相等. windows下的字符串str默认编码是ascii,而pytho ...

  2. Python——UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal

    当字符串比较中有中文时,需要在中文字符串前加 u  转为unicode编码才可以正常比较. str == u"中文"

  3. 关于在2.7中出现 "UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal"

    在中文字符串前面加u. Make sure your code is in UTF-8 (NOT Latin-1) and/or use a coding line as so: #! /usr/bi ...

  4. Mac环境安装非APP STORE中下载的软件,运行报错:“XXX” is damaged and can’t be opened. You should move it to the Trash. 解决办法

    出现这个错误的大多数原因都是因为系统设置的问题,因为系统不信任你从其他地方下载的软件安装包,所以运行时就给你阻止了.具体的设置步骤如下: 1. 打开系统偏好设置 (System Preferences ...

  5. 【转载】Docker 安装后 报 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? 解决办法

    Docker Docker 安装后 报 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docke ...

  6. xcode 运行报错 Command /usr/bin/codesign failed with exit code 1

           因为更换了证书,导致在运行时报错 Command /usr/bin/codesign failed with exit code 1,查看了网上各种方法,最后发现以下两个值没有同步更新

  7. jdk1.8+SpringAOP注解报java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut select错误的不知原因的解决办法[仅供参考]

    先说办法:如果Aspectweaver-1.*.*jar这三个包版本比较低, 比如1.5.0这一层次的,可以找版本高一点的包替换低版本的包,问题可以得到解决 jar包的下载地址:https://mvn ...

  8. 运行报警告UserWarning: Unknown extension is not supported and will be removed warn(msg)

    运行python代码,出现如下警告: C:\Users\niko\PycharmProjects\python_new\venv\lib\site-packages\openpyxl\reader\w ...

  9. spring 以Ant Build方式运行build.xml文件,报warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds 的解决办法

    Buildfile: F:\experience\spring_pdf\sourcecode\example1\build.xml compile: [javac] F:\experience\spr ...

随机推荐

  1. C# linq根据自定义筛选条件和所对应的数值进行筛选

    在软件应用中有时候会出现这样的界面:上面是利用多选框和下拉框组合的筛选条件.下面表格展示筛选后的数据.如下图 上面是筛选条件,表格是根据筛选条件筛选的结果. 如果表格不支持筛选功能.可以利用Linq对 ...

  2. (转) HTTP Request header

    HTTP Request header 当今web程序的开发技术真是百家争鸣,ASP.NET, PHP, JSP,Perl, AJAX 等等. 无论Web技术在未来如何发展,理解Web程序之间通信的基 ...

  3. C语言——字符串长度的计算方法

    1.不带转义字符的字符串 如:“abc!x=/”,其长度为7 2.带转义字符的字符串 (1) 字符串“abc\n”:其中的'\n'为转义字符(换行符),计算字符串长度时只能计作一个字符,所以该字符串的 ...

  4. linux 命令——20 find(转)

    find是我们很常用的一个Linux命令,但是我们一般查找出来的并不仅仅是看看而已,还会有进一步的操作,这个时候exec的作用就显现出来了. exec解释: -exec  参数后面跟的是command ...

  5. Select与SelectMany

    SelectMany在MSDN中的解释:将序列的每个元素投影到 IEnumerable(T) 并将结果序列合并为一个序列. 不用去用foreach进行两次遍历,就可以将子循环需要的元素过滤出来... ...

  6. IOS -刷帧动画(CADisplayLink)

    @property (nonatomic, assign) int imageY; @end @implementation NJView -(void)awakeFromNib { NSLog(@& ...

  7. Android(java)学习笔记74:ListViewProject案例(ListView + ArrayAdapter)

    1. 首先是MainActivity.java文件,如下: package com.himi.lv1; import java.util.ArrayList; import java.util.Lis ...

  8. oracle用户创建及权限设置(转)

    权限: create session create table unlimited tablespace connect resource dba 例: #sqlplus /nolog SQL> ...

  9. IDEA注释模板设置

    1. 文件注释 1.1 Java类文件注释 Setting -> Editor -> File and Code Templates -> Includes -> File H ...

  10. MintLinux

    最近将我的mintlinux进行了一系列外观优化,总算好看了一点