自己总是写程序时候用 + 拼接的时候忘记变量类型要一致,如下面

  1. frame_num = "1"
  2. for i in range(1, frame_num + 1, 1):
  3. self.by_xpath("//table/tbody/tr[{}]/td[2]/input[1]".format(i)).send_keys(min_price)
  4. self.by_xpath("//table/tbody/tr[{}]/td[2]/input[2]".format(i)).send_keys(max_price)

上面的代码其实变量是个字符串,但是计算的是Int,所以要记得转换

  1. for i in range(1, int(frame_num) + 1, 1):
  2. self.by_xpath("//table/tbody/tr[{}]/td[2]/input[1]".format(i)).send_keys(min_price)
  3. self.by_xpath("//table/tbody/tr[{}]/td[2]/input[2]".format(i)).send_keys(max_price)

问题不大,重在细心

【问题记录】Python运行报错:can only concatenate str (not "int") to str的更多相关文章

  1. python运行报错:urllib2.URLError: <urlopen error [Errno 10061] >

    Traceback (most recent call last): File "F:\adt-bundle-windows-x86_64-20140702\eclipse\workspac ...

  2. python mysqldb 报错: ProgrammingError: must be real number, not str 解决

    代码: sql = 'insert into book(book_name,book_desc,origin_price,publish_id,tag_id,book_img) values(%s,% ...

  3. python 运行报错 Process finished with exit code -1073741819 (0xC0000005)

    发现是由于openpyxl模块导致的,去掉这个模块的内容就能运行,import openpyxl就运行不起来, 将openpyxl卸载了重装, 以及更换了不同的openpyxl版本,都不行,还是运行不 ...

  4. python运行报错——注释报错

    本人是IT行业的,从事软件测试,还是个菜鸟.希望大神们多多关照~ 首先,开通这个博客的目的: 1)通常我容易犯一些低级的错误,而且在网上找到解决方法,解决之后时间长了又不记得: 2)想和有共同兴趣的人 ...

  5. python运行报错:cannot import name 'InteractiveConsole'

    ModuleNotFoundError: No module named '_pydevd_bundle.pydevd_cython' ImportError: cannot import name ...

  6. Python首次安装后运行报错(0xc000007b)的解决方法

    最近在安装完Python后运行发现居然报错了,错误代码是0xc000007b,于是通过往上查找发现是因为首次安装Python缺乏VC++库的原因,下面通过这篇文章看看如何解决这个问题吧.   错误提示 ...

  7. 【Python】pyinstaller打包运行报错failed to execute script main

    前言 最近用pyinstaller打包的时候一直报"failed to execute script main". 最终使用"pyinstaller --hidden-i ...

  8. 第一次打开pycharm运行python文件报错”No Python interpreter selected“问题的解决办法

    前面没有细讲,这里细述一下安装pycharm后,第一次打开pycharm运行python文件报错"No Python interpreter selected"问题的解决办法. 出 ...

  9. python webdriver 报错WebDriverException: Message: can't access dead object的原因(pycharm中)

    PyCharm中运行firefox webdriver访问邮箱添加通讯录的时候报错-WebDriverException: Message: can't access dead object 调了半天 ...

随机推荐

  1. Cannot+use+T4+templates+inside+a+.NET+Core+project,NetCore2.0无法使用T4模板解决方法

    Cannot+use+T4+templates+inside+a+.NET+Core+project,NetCore2.0无法使用T4模板解决方法 请见:https://csharp.wekeepco ...

  2. Python基础学习三 list-增删改查、切片、循环、排序

    一.list 增删改查 1.增加 方式一: stus = ['xiaohei','xiaobai','xiaohuang','cxdser'] stus.append('test001')#从最后面开 ...

  3. MapReduce和YARN框架

    MapReduce组件如图

  4. Linux下查看进程的命令输出的内容解释

    Linux下查看进程的命令输出的内容解释 ps (process status) ps -e 或者ps -A (-e和-A完全一样) PID           TTY         TIME   ...

  5. EOFException异常的处理

    TOmcat启动后报:IOException while loading persisted sessions: Java.io.EOFException错误 - IOException while ...

  6. 虚拟机安装CentOS以及SecureCRT设置【完美无错版】

    一.CentOS简介 CentOS是Linux的发行版之一,它安全.稳定.高效,是我最喜欢的Linux发行版之一.CentOS根据Red Hat Enterprise Linux开放源代码编译而成,与 ...

  7. ArcGIS Engine中如何获取Map中已经选择的要素呢(转)

    ArcGIS Engine中如何获取Map中已经选择的要素呢   1.使用IEnumFeturea对象获取map中的FeatureSelection,该方法可以获取所有图层的选择要素.IMap中的Fe ...

  8. 599. Minimum Index Sum of Two Lists两个餐厅列表的索引和最小

    [抄题]: Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of fa ...

  9. 为docker设置国内镜像

    docker的默认镜像(https://hub.docker.com/)地址,拉取镜像时是比较慢的,经常会超时,有时拉取几个小时.为了加快拉取的时间和速度,需要添加中国的镜像地址: 国内的加速地址: ...

  10. ArcGIS坐标转换

    我忘了怎么设置坐标系了- 定义投影ArcCatalog设置?  -arctoolbox好像都可以   感觉不用想的那么复杂]直接定义投影就行了  选这一个吗  这个就行了'  然后?  应该是先定义成 ...