python报错:TypeError: can’t multiply sequence by non-int of type 'float’

注意:csdn标题没法用英文引号,以后注意别搜引号!!!!

比如,想搜这个报错,别直接搜TypeError: can't multiply sequence by non-int of type 'float',要搜multiply sequence by non-int of type!!!

现象


报了个错,不知啥情况

解决办法

检查了一下,发现是我像素值赋值的时候前面没加img,加上就好了- -

报错原因

没加img的时候,fq1和fq3是列表,而python中列表与数字相乘是这样,它是按列表最外层空间扩增的

a = [[1, 2, 2.2], [4, 5], [4, 4]]
print(a * 3)    # [[1, 2, 2.2], [4, 5], [4, 4], [1, 2, 2.2], [4, 5], [4, 4], [1, 2, 2.2], [4, 5], [4, 4]]
b = [1.1, 2]
print(b * 2)  # [1.1, 2, 1.1, 2]

如果被乘的数是小数(浮点数float),肯定就不行啦

b = [1.1, 2]
print(b * 2.0)
D:\20200228_play_with_pytorch\python\python.exe C:/Users/SIQI/Desktop/数字图像处理/test.py
Traceback (most recent call last):File "C:/Users/SIQI/Desktop/数字图像处理/test.py", line 15, in <module>print(b * 2.0)  # [1.1, 2, 1.1, 2]
TypeError: can't multiply sequence by non-int of type 'float'Process finished with exit code 1

python报错:TypeError: cant multiply sequence by non-int of type float(bug)(csdn标题没法用英文引号,以后注意别搜引号)相关推荐

  1. Python报错TypeError: 'str' object is not callable

    原文:http://blog.sina.com.cn/s/blog_71f3890901017rsh.html Python报错TypeError: 'str' object is not calla ...

  2. python报错 TypeError: an integer is required

    问题描述: 在本地使用socket向NetAssist传送数据的时候,执行python文件后发现报出python 报错TypeError: an integer is required错误 代码: 1 ...

  3. Python报错TypeError: ‘User‘ object is not iterable

    Python报错TypeError: 'User' object is not iterable 原因 User对象是不可迭代的,我这里是因为User并不是list,所以是不可迭代的,所以不使用迭代即 ...

  4. Python报错 TypeError: Descriptors cannot not be created directly

    Python报错TypeError: Descriptors cannot not be created directly 具体错误: TypeError: Descriptors cannot no ...

  5. Python报错TypeError: Descriptors cannot not be created directly

    Python报错TypeError: Descriptors cannot not be created directly 具体错误: TypeError: Descriptors cannot no ...

  6. python报错TypeError: must be str, not int

    python报错TypeError: must be str, not int 字符串拼接一个整型变量报错,代码如下 for i in range(1,586):res = 'test' + i 报错 ...

  7. Python 报错TypeError: expected string or bytes-like object

    问题描述:Python 中报错TypeError: expected string or bytes-like object 解决方法:根据报错上方的提示信息,大体猜测到可能出错的具体地方.出现该报错 ...

  8. python报错:fails to pass a sanity check due to a bug in the windows runtime

    Python报错(Anaconda或者PyCharm): RuntimeError: The current Numpy installation ('D:\Develop\anaconda\lib\ ...

  9. python报错1-'int' object is not iterable('int'对象不可迭代)

    python报错:'int' object is not iterable 含义:'int'对象不可迭代 解决办法:不能直接用int进行迭代,而必须加个range 如: for i in range( ...

最新文章

  1. 存储引擎:MySQL系列之七
  2. 八成Java开发者解答不了的问题
  3. south eastern china at a scope of 100km
  4. pythonsql注入_python使用mysql,sql注入问题
  5. 融创上海:从营销切入,建立自上而下的数据平台,实现数据应用
  6. Qt QMYSQL driver not loaded 解决办法
  7. 实操长文|评估风控策略效果(全)
  8. linux 解压 7z 乱码,7z-linux下解决中文名乱码的终极办法
  9. dm7达梦7Linux安装包,【达梦】DM7安装部署 2 安装达梦7数据库软件
  10. 友盟+短视频行业研究
  11. 5个免费商用音频素材网站
  12. 领航致远_李腾飞老师javascript_html_css视频教程
  13. Websphere应用部署发布
  14. 智链ChainNova携手IBM推出端到端区块链解决方案
  15. DOS命令——calcs和icacls
  16. 华为高性能服务器实验室,1000平米全球唯一!华为神秘实验室首公开
  17. 戴尔业务伸向IT服务:佩罗收购毕博背后
  18. 志愿填报在即,店宝宝告诉你,高薪的专业有哪些?
  19. 互动机顶盒与普通机顶盒比较
  20. Linux 校园网 锐捷客户端 ruijieclient

热门文章

  1. 51,AVR,PIC,DSP,DIY等资源
  2. 全面降低windows系统的安全隐患 (四)
  3. Mastering Caching in Asp.net
  4. SAP CS模块拓展项目实施建议书
  5. SAP 730模糊查询时不可以输入连续的汉字问题解决方案
  6. LSMW批处理使用方法(10)_步骤12、13
  7. 物料分类账的基本原理
  8. XP系统自动关机命令
  9. java entries_Java leveldb遍历特定前缀的entries
  10. cllocationmanager 获取不了 的原因_我的世界:天启之境如何获取“人鱼手链”?一段人鱼姬的爱情故事...