TypeError: a bytes-like object is required, not 'str'

json.decoder.JSONDecodeError: Extra data

json文件太大,改为单行读取:

with open("a", "r+") as f:
data = json.load(f) 改为: with open("a.json", "r+") as f:
data = f.readline()

UnicodeEncodeError: 'gbk' codec can't encode character u'\xe7' in position

将 print(res.txt) 改成 print(res.text).encode('gbk','ignore')

Https相关

  requests发送HTTPS
前提:verify=False
报错:InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
解决:
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) 多线程 - connectionpool.py https请求 InsecureRequestWarning
解决:注释掉connectionpool.py的845-851行

 

IDE相关

 Pycharm
全局查询关键字
按快捷键Ctrl + Shift + F或从从菜单Edit-》Find-》Find in Path进入全局查找界面

 

爬虫相关

Max retries exceeded with url
.requests.adapters.DEFAULT_RETRIES =
.s = requests.session()
s.keep_alive = False

 

Pycharm

File size exceeds configured limit 2.5M. Code insight features not available
help -》Edit custom properities -》输入 idea.max.intellisense.filesize=

 

字节/字符转换问题

TypeError: a bytes-like object is required, not ‘str’
str -》 encode()-》bytes
bytes -》decode() -》str

 

共存

python3-m pip install --upgrade pip --force-reinstall 
python2-m pip install --upgrade pip --force-reinstall

netaddr

用途
ip地址管理

安装

pip3 install netaddr

模块 - Queue

用途
队列 使用
from queue import Queue

包安装报错

Crypto.Cipher

Python3-问题整理的更多相关文章

  1. python3 基础整理

    基础语法 1.python中区分大小写 2.查看关键字用 import keyword print (keyword.kwlist) 3.注释 #  单行注释,多行注释的快捷键是ctr+/,取消注释的 ...

  2. python3.7 内置函数整理

    #!/usr/bin/env python __author__ = "lrtao2010" #python3.7 内置函数整理 #abs(x) #返回数字的绝对值. 参数可以是整 ...

  3. python3.7内置函数整理笔记

    #python3.7 内置函数整理 #abs(x) #返回数字的绝对值. 参数可以是整数或浮点数. 如果参数是复数,则返回其大小 # print(abs(1)) # print(abs(-1)) # ...

  4. 整理了最全的Python3数据类型转换方法,可以收藏当手册用

    本文基于python3.8版本,总结了各种数据类型直接的转换规则和方法.算是比较全了,可以收藏当手册来查. 概述 数据类型转换,指的是通过某种方法,将一个数据由原来的类型转换为另外一个类型.比如,我们 ...

  5. 整理一下pywinauto 的sendeys(py2.7)换成python3.6用PyUserInput

    没办法入门学的是py3.6所以有些只支持2.7的库保好放弃了 senkeys (2.7)==>pyuserinput (3.6) ================================ ...

  6. Python3的编码整理总结

    python3在内存中是用unicode编码方式存储的,所以不能直接储存和传输,要转化为其他编码进行储存和传输. 字符串通过编码转换成字节码,字节码通过解码成为字符串 encode:str --> ...

  7. 字符编码 + python2和python3的编码区别(day08整理)

    目录 昨日回顾 二十三.元组内置方法 二十四.散列表 二十五.字典内置方法 二十六.集合内置方法 二十七.深浅拷贝 拷贝 浅拷贝 深拷贝 今日内容 二十八.字符编码 1.文本编辑器存储信息的过程 2. ...

  8. python2与python3的区别齐全【整理】

    本文链接:https://blog.csdn.net/pangzhaowen/article/details/80650478 展开 一.核心类差异1. Python3 对 Unicode 字符的原生 ...

  9. Python3整理文件

    晚上打算把播放器下载下来的音乐拷贝到mp3里边,但是它是如下形式存放的,相当头痛…… 作为程序员,想到使用python来遍历这个目录,并将有大于限制的音乐文件拷贝到指定目录,相关实现代码如下: # a ...

  10. 廖雪峰老师Python3教程练习整理

    1.定义一个函数quadratic(a, b, c),接收3个参数,返回一元二次方程:ax2 + bx + c = 0的两个解 # -*- coding: utf-8 -*-import mathde ...

随机推荐

  1. C/C++二维数组名和二级指针

    转载 :https://blog.csdn.net/wu_nan_nan/article/details/51741030  作者:吴一奇 1. 指针1.1 一个指针包含两方面:a) 地址值:b) 所 ...

  2. 使用git版本管理时的免密问题

    方式1 使用ssh 方式 方式2 使用命令  git config --global  credential.helper store 会把密码存放到当前用户的home目录下的 该文件中 [root@ ...

  3. 二分查找---有序数组的 Single Element

    有序数组的 Single Element 540. Single Element in a Sorted Array (Medium) Input: [1, 1, 2, 3, 3, 4, 4, 8, ...

  4. 一步一步玩控件:自定义TabControl——从山寨Safari开始

    作者:野比 (conmajia@gmail.com) 时间:May, 2012 封面图片为野比原创,请勿未经允许私自引用 #1-1 嗯,各位,又是我,生物钟颠倒的家伙. 今天我要山寨的是大名鼎鼎的Ap ...

  5. Add JWT Bearer Authorization to Swagger and ASP.NET Core

    Add JWT Bearer Authorization to Swagger and ASP.NET Core     If you have an ASP.NET Core web applica ...

  6. postgres - 以单用户模式运行一个 PostgreSQL服务器

    SYNOPSIS postgres [ -A 0 | 1] [ -B nbuffers] [ -c name=value] [ -d debug-level] [ --describe-config ...

  7. unixbench

    1.下载 https://github.com/kdlucas/byte-unixbench/archive/v5.1.3.tar.gz 2.修改Makefile 交叉编译 #CC=gccCC = a ...

  8. JS基础入门篇(七)—运算符

    1.算术运算符 1.算术运算符 算术运算符:+ ,- ,* ,/ ,%(取余) ,++ ,-- . 重点:++和--前置和后置的区别. 1.1 前置 ++ 和 后置 ++ 前置++:先自增值,再使用值 ...

  9. a[b]和b[a]区别

    #include <stdio.h> main() { char a[5] = "abcd"; int b = 3; printf("%c\n",a ...

  10. mysql order by 自定义

    TIMESTAMPDIFF 语法: TIMESTAMPDIFF(interval,datetime_expr1,datetime_expr2). 说明: 返回日期或日期时间表达式datetime_ex ...