Error Msg

Traceback (most recent call last):
File "E:/code/adva_code/my_orm.py", line 108, in <module>
user.save()
File "E:/code/adva_code/my_orm.py", line 91, in save
sql = "insert {}({}) value({})".format(self._meta["db_table"], ",".join(fields), ",".join(values))
TypeError: sequence item 1: expected str instance, int found

问题:

  ",".join()接收的参数必须是str类型, 不接受其他类型

解决:

  修改join()参数为列表, 列表中全部为str类型: ","join(["1", "2", "3"...])

TypeError: sequence item 1: expected str instance, int found的更多相关文章

  1. Pandas to_sql TypeError: sequence item 0: expected str instance, dict found

    问题介绍 打印了一下数据格式,并未发现问题.如果说是字典实例引起的. 我猜测也是extra字段引起的,因为extra字段是一个json字段.根据网上的提示要对这样的格式进行强转str. 其他发现:pd ...

  2. TypeError: sequence item 0: expected string, Tag found

    原始代码: soup = BeautifulSoup(result, 'html.parser') content_list = soup.find_all('p', attrs={"cla ...

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

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

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

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

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

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

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

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

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

  8. Python 读写文件 中文乱码 错误TypeError: write() argument must be str, not bytes+

    今天写上传文件代码,如下 def uploadHandle(request): pic1=request.FILES['pic1'] picName=os.path.join(settings.MED ...

  9. Python错误TypeError: write() argument must be str, not bytes

    2016-07-03 20:51:25 今天使用Python中的pickle存储的时候出现了以下错误: TypeError: write() argument must be str, not byt ...

随机推荐

  1. 巨杉数据库入选Gartner数据库报告,中国首家入选厂商

    SequoiaDB巨杉数据库入选Gartner数据库报告,成为国内首批入选Gartner报告的数据库厂商. “SequoiaDB, 总部位于中国广州,是一款分布式.多模型(Multimodel).高可 ...

  2. Docker入门(二)在docker使用MongoDB

      本文将介绍如何在docker中使用MongoDB.   如果你是一名MongoDB的初学者,那么你入门MongoDB的第一件事就是安装MongoDB,但是安装MongoDB又不是一件简单的事情,还 ...

  3. [leetcode](4.21)2. 按字典序排列最小的等效字符串

    给出长度相同的两个字符串:A 和 B,其中 A[i] 和 B[i] 是一组等价字符.举个例子,如果 A = "abc" 且 B = "cde",那么就有 'a' ...

  4. input框限制只能输入正整数、字母、小数、

    这篇博文大部分来自于网上,为了方便自己查阅,以及帮助他人.   1,只能输入正整数 <input onkeyup="if(this.value.length==1){this.valu ...

  5. Django 笔记分享

    Django是一个基于MVC构造的框架.但是在Django中,控制器接受用户输入的部分由框架自行处理,所以 Django 里更关注的是模型(Model).模板(Template)和视图(Views), ...

  6. 小记 xian80 坐标转换 wgs84

    转坐标这个问题是个老生常谈的话题了. 昨天遇到同事求助将 xian80的平面坐标转换到2000下. 想了一下,因为暂时还没有现成的2000的dwg数据可用,只能暂时以wgs84的为准了,然而有个问题, ...

  7. 华为云的API调用实践(python版本)

    一.结论: 1.华为云是符合openstack 社区的API,所以,以社区的API为准.社区API见下面的链接. https://developer.openstack.org/api-ref/net ...

  8. Android为TV端助力 完全解析模拟遥控器按键

    public class VirturlKeyPadCtr { private static Instrumentation mInstrumentation; public static void ...

  9. Ubuntu 18.04 安装博通(Broadcom)无线网卡驱动

    目录 Ubuntu 18.04 安装博通(Broadcom)无线网卡驱动 Package gcc is not configured yet. 解决办法 history history | grep ...

  10. 如何在MongoDB设计存储你的数据(JSON化)?

    第一步 定义要描述的数据集 当我们决定将数据存储下来的时候,我们首先要回答的一个问题就是:“我打算存储什么样的数据?这些数据之间有什么关系?实体之间有什么关系?实体的属性之间有什么关系”. 为了说明问 ...