偶尔会用到的知识

format问题
# 想要输出大括号
f = '{{{}}}'.format('123')
assert f == '{123}'
pytest问题
py.test test_conf2bin.py  --cov-report=html --cov-config=.coveragerc --cov=.

gunicorn 或 pytest 找不到问题

重新安装pip3 install pytest, 就能看到warning “/usr/local/python3/bin” not in PATH
解决方案, 在vi /etc/profile加上export PATH=$PATH:/usr/local/python3/bin 后
source /etc/profile就好了

python json.dumps 中的ensure_ascii 参数引起的中文编码问题

https://www.cnblogs.com/biangbiang/archive/2013/02/19/2916780.html

mongo 对缺少的字段, 以及none的字段进行区分

df = pd.DataFrame([{'a': -1}, {'b': -1, 'c': None}], dtype=object)
>>>df
     a    b     c
0   -1  NaN   NaN
1  NaN   -1  None

按照值进行区分

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值