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. 【Node.js】一、搭建基于Express框架运行环境+更换HTML视图引擎

      1)安装express generator生成器 这个express generator生成器类似于vue-cli脚手架工具,用来创建一个后端项目,首先我们要对生成器进行全局安装,在cmd中输入下 ...

  2. c语言之gdb调试。

    1.此文档演示如何使用gdb调试c语言代码. 代码如下: #include <stdio.h> /*函数声明*/ void digui(int n); int main() { ; dig ...

  3. 在windows中创建.gitignore文件

    1.先任意创建一个文件,例如:1.txt 2.打开cmd命令行窗口,到1.txt目录下 windows7/8输入ren 1.txt .gitignore修改成功 windows10输入mv 1.txt ...

  4. MySql如何查询JSON字段值的指定key的数据

    实例:SELECT param->'$.pay' as pay_type FROM game.roominfo; 其中:param是roominfo表的一个字段,当中存的是JSON字符串,pay ...

  5. fork/join概述

    Fork/Join是java 7 解决并发问题的解决方案. 是 java内部并行框架.核心思想分别为拆分任务和结果合并,在核心思想外,为了提高cpu多核的利用率,设计了工作窃取算法,并将工作队列设计为 ...

  6. 对HTML5标签的认识(二)

    ---恢复内容开始--- 这次随笔主要讲一下列表标签.链接标签.和表格标签.图像标签.音频标签.及视频标签的运用及作用. 一.<ul>和<ol> 首先先了解一下<ul&g ...

  7. 面试题之(vue生命周期)

    在面试的时候,vue生命周期被考察的很频繁. 什么是vue生命周期呢? Vue实例有一个完整的生命周期,也就是从开始创建.初始化数据.编译模板.挂载Dom.渲染→更新→渲染.卸载等一系列过程,我们称这 ...

  8. 不指定源ip时,系统选择哪个ip作为ping包的源ip?

    问题:当centos 有多个网口,发起ping包时,是根据什么规则来确定是使用哪个源ip? 解答:根据目的ip来确定,迭代可以确定源ip 具体的确定方法是, (1)先根据目的ip来确定使用哪个路由表项 ...

  9. SVN上传的时候没法显示文件名,只显示后缀名

    之前在用SVN上传android代码的时候,发现上传列表上的文件没法显示名字,只显示了后缀名,就像这样: 各种疑惑,最终发现解决方法: 右键单击操作栏的status: 然后在出现的选项里面将filen ...

  10. EditText超出字数限制,给用户提示

    当我们在Editext输入内容的时候,检测如果超过限制的长度无法输入内容,并且给用户提示. 首先我想到了下面的方法: editText.addTextChangedListener(new TextW ...