python 问题整理

1. json转换时,中文乱码

设置参数 ensure_ascii=False解决

jsonBody=json.dumps(body,ensure_ascii=False)

参照:json字符讲解

https://blog.csdn.net/u014431852/article/details/53058951

 

2. https请求时关闭ssl安全验证

设置参数verify=False 
res=self.session.post(url=url,data=jsonBody.encode('utf-8'),headers=headers,verify=False)


3. 安装mysql模块失败

pip.exe install MySQL-python
running build_ext
building '_mysql' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visu
C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

安装第三方pymsql模块也可以,MySQL-python对高版本python不支持了。

 

4.pycharm创建py文件时,增加默认注解

#coding:utf-8
'''
@author: jinff
@license: (C) Copyright 2016-2020, 中国制造
@contact:
@file: ${NAME}.py
@time: ${DATE} ${TIME}
@desc:
'''

 



 

posted @ 2018-10-23 13:42  M兔  阅读(125)  评论(0编辑  收藏  举报