<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[调皮博士的博客]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/github_38854366</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; github_38854366]]></copyright><item><title><![CDATA[用Mongodb与flask-sqlalchemy分别实现分段统计]]></title><link>https://blog.youkuaiyun.com/github_38854366/article/details/114521120</link><guid>https://blog.youkuaiyun.com/github_38854366/article/details/114521120</guid><author>github_38854366</author><pubDate>Mon, 08 Mar 2021 10:35:51 +0800</pubDate><description><![CDATA[统计60分以上各分段的人数
grade = [x*10 for x in range(6，11)]

# MongoDB
query = {"mark": {"$gte": grade[0], "$lte": grade[-1]}}
data1 = list(current_app.mongo.db.exam.aggregate([
    {"$match": query},
    {"$bucket": {
        "groupBy": "$grade",
        "boundarie]]></description><category></category></item><item><title><![CDATA[关于使用.gitignore文件忽略目标文件夹下的子文件夹时会把整个父文件夹忽略掉的问题]]></title><link>https://blog.youkuaiyun.com/github_38854366/article/details/109102442</link><guid>https://blog.youkuaiyun.com/github_38854366/article/details/109102442</guid><author>github_38854366</author><pubDate>Thu, 15 Oct 2020 18:42:38 +0800</pubDate><description><![CDATA[问题描述：
根目录下有这么一个目录：

根目录.gitignore文件配置如下：
.
.
.
images/photos/*

照理来说应该只会忽略掉上图中的photos文件夹内的全部内容，但实际上它却把images整个父文件夹都给忽略掉了。
中间的摸索过程就不多说了，直接说结论吧。
git会自动把空文件夹忽略掉
上面由于只有photos文件夹内有文件，如果把它给忽略，那整个images文件夹都没有文件了，所以git就把images文件夹给忽略了。
那如果想保留文件夹只忽略掉里面的文件该怎么做呢？
方法一：]]></description><category></category></item><item><title><![CDATA[为什么Python 3.6以后字典有序并且效率更高？]]></title><link>https://blog.youkuaiyun.com/github_38854366/article/details/106993420</link><guid>https://blog.youkuaiyun.com/github_38854366/article/details/106993420</guid><author>github_38854366</author><pubDate>Sun, 28 Jun 2020 10:17:21 +0800</pubDate><description><![CDATA[在Python 3.5（含）以前，字典是不能保证顺序的，键值对A先插入字典，键值对B后插入字典，但是当你打印字典的Keys列表时，你会发现B可能在A的前面。
但是从Python 3.6开始，字典是变成有顺序的了。你先插入键值对A，后插入键值对B，那么当你打印Keys列表的时候，你就会发现B在A的后面。
不仅如此，从Python 3.6开始，下面的三种遍历操作，效率要高于Python 3.5之前：
for key in 字典

for value in 字典.values()

for key, value ]]></description><category></category></item><item><title><![CDATA[itertools ——为高效循环而创建迭代器的函数]]></title><link>https://blog.youkuaiyun.com/github_38854366/article/details/106767791</link><guid>https://blog.youkuaiyun.com/github_38854366/article/details/106767791</guid><author>github_38854366</author><pubDate>Mon, 15 Jun 2020 17:56:11 +0800</pubDate><description><![CDATA[本模块标准化了一个快速、高效利用内存的核心工具集，这些工具本身或组合都很有用。它们一起形成了“迭代器代数”，这使得在纯Python中有可能创建简洁又高效的专用工具。

无穷迭代器：




迭代器
实参
结果
示例




count()
start, [step]
start, start+step, start+2*step, …
count(10) --&gt; 10 11 12 13 14 …


cycle()
p
p0, p1, … plast, p0, p1, …
cycle(‘ABCD’).]]></description><category></category></item><item><title><![CDATA[数据结构的扩展库——collections]]></title><link>https://blog.youkuaiyun.com/github_38854366/article/details/106662682</link><guid>https://blog.youkuaiyun.com/github_38854366/article/details/106662682</guid><author>github_38854366</author><pubDate>Wed, 10 Jun 2020 14:25:26 +0800</pubDate><description><![CDATA[这个模块实现了特定目标的容器，以提供Python标准内建容器 dict , list , set , 和 tuple 的替代选择。





方法名
说明




namedtuple()
创建命名元组子类的工厂函数


deque
类似列表(list)的容器，实现了在两端快速添加(append)和弹出(pop)


ChainMap
类似字典(dict)的容器类，将多个映射集合到一个视图里面


Counter
字典的子类，提供了可哈希对象的计数功能


OrderedDict
字典的子类，保存了他们被.]]></description><category></category></item><item><title><![CDATA[《Redis in Action》——不仅仅是缓存 部分翻译]]></title><link>https://blog.youkuaiyun.com/github_38854366/article/details/106468304</link><guid>https://blog.youkuaiyun.com/github_38854366/article/details/106468304</guid><author>github_38854366</author><pubDate>Mon, 01 Jun 2020 17:45:25 +0800</pubDate><description><![CDATA[Voting on articles

First, let’s start with some numbers and limitations on our problem, so we can solve the problem without losing sight of what we’re trying to do. Let’s say that 1,000 articles are submitted each day. Of those 1,000 articles, about 50 of]]></description><category></category></item><item><title><![CDATA[python中使用qrcode库生成二维码时，填充logo变成黑白色的解决方法。]]></title><link>https://blog.youkuaiyun.com/github_38854366/article/details/105226770</link><guid>https://blog.youkuaiyun.com/github_38854366/article/details/105226770</guid><author>github_38854366</author><pubDate>Tue, 31 Mar 2020 17:34:53 +0800</pubDate><description><![CDATA[python如何生成qrcode的教程已经有很多了，我这里仅仅排一下坑。
import qrcode
from PIL import Image


qr = qrcode.QRCode(
    version=1,
    error_correction=qrcode.constants.ERROR_CORRECT_H,
    box_size=10,
    border=4
)
qr....]]></description><category></category></item><item><title><![CDATA[为什么python在urlencode空格的时候会被编码成“20”而不是“+”？]]></title><link>https://blog.youkuaiyun.com/github_38854366/article/details/104801560</link><guid>https://blog.youkuaiyun.com/github_38854366/article/details/104801560</guid><author>github_38854366</author><pubDate>Wed, 11 Mar 2020 17:39:37 +0800</pubDate><description><![CDATA[1、简介

空格目前有两种不同的编码方式，一种是在HTML4中定义的，而另一种是在RFC-3986中定义的。

1.1 HTML4编码方式

HTML4的application/x-www-form-urlencoded一节对空格的编码定义如下：

Control names and values are escaped. Space characters are replaced by+', ...]]></description><category></category></item><item><title><![CDATA[关于RESTful风格接口设计的理解]]></title><link>https://blog.youkuaiyun.com/github_38854366/article/details/104611147</link><guid>https://blog.youkuaiyun.com/github_38854366/article/details/104611147</guid><author>github_38854366</author><pubDate>Mon, 02 Mar 2020 16:49:23 +0800</pubDate><description><![CDATA[RESTful的概念


表现层状态转换（英语：Representational State Transfer，缩写：REST）是Roy Thomas Fielding博士于2000年在他的博士论文[1]中提出来的一种万维网软件架构风格，目的是便于不同软件/程序在网络（例如互联网）中互相传递信息。表现层状态转换是根基于超文本传输协议（HTTP）之上而确定的一组约束和属性，是一种设计提供万维网络服务...]]></description><category></category></item><item><title><![CDATA[关于django makemigrations/migrate在生成数据表上遇到的一些问题]]></title><link>https://blog.youkuaiyun.com/github_38854366/article/details/81015647</link><guid>https://blog.youkuaiyun.com/github_38854366/article/details/81015647</guid><author>github_38854366</author><pubDate>Thu, 12 Jul 2018 15:33:33 +0800</pubDate><description><![CDATA[由于公司以前的项目采用的是通过sql文件迁移数据库的方法，虽然在后续接手工作的时候没什么不适，但是对于一个全新的项目来说，要重新手动生成数据库表实在太花时间了，还容易导致model与表结构不一致，故此特意认真学习使用migrate这个功能。问题一：makemigrations并migrate后，发现有的model并没有生成数据表。重新makemigrations却提示No changes dete...]]></description><category></category></item><item><title><![CDATA[cookiecutter个性化心得]]></title><link>https://blog.youkuaiyun.com/github_38854366/article/details/80283215</link><guid>https://blog.youkuaiyun.com/github_38854366/article/details/80283215</guid><author>github_38854366</author><pubDate>Fri, 11 May 2018 16:58:00 +0800</pubDate><description><![CDATA[cookiecutter描述：        通过cookiecutter解包项目模板文件，实现一个命令行生成项目。个性化目标：        0.自定义项目模板        1.内置项目模板(无需再输入模板路径）解决思路：        0.解包参考项目模板与生成项目之间的关联        1.实现自定义模板        2.重构cookiecutter添加默认模板路径        3....]]></description><category></category></item><item><title><![CDATA[python中关于cur.connect()等方法的应用实例]]></title><link>https://blog.youkuaiyun.com/github_38854366/article/details/78558582</link><guid>https://blog.youkuaiyun.com/github_38854366/article/details/78558582</guid><author>github_38854366</author><pubDate>Fri, 17 Nov 2017 10:46:54 +0800</pubDate><description><![CDATA[实例1、取得MYSQL的版本

在windows环境下安装mysql模块用于python开发，请见我的另一篇文章：

MySQL-python Windows下EXE安装文件下载

# -*- coding: UTF-8 -*-

#安装MYSQL DB for python
import MySQLdb as mdb

con = None

try:
    #连接mysql的方法]]></description><category></category></item><item><title><![CDATA[记录两个网址：jquery动态添加html代码 以及 图标库]]></title><link>https://blog.youkuaiyun.com/github_38854366/article/details/78476388</link><guid>https://blog.youkuaiyun.com/github_38854366/article/details/78476388</guid><author>github_38854366</author><pubDate>Wed, 08 Nov 2017 11:05:50 +0800</pubDate><description><![CDATA[jQuery实现动态添加html代码






图标库]]></description><category></category></item><item><title><![CDATA[前端与后端的数据交互（jquery ajax+python flask）]]></title><link>https://blog.youkuaiyun.com/github_38854366/article/details/78400978</link><guid>https://blog.youkuaiyun.com/github_38854366/article/details/78400978</guid><author>github_38854366</author><pubDate>Tue, 31 Oct 2017 10:54:20 +0800</pubDate><description><![CDATA[前排回忆一下遇到的坑:
1.标签下的、等标签必须带有name属性才能被form捕捉提交。
2.POST方法提交时要用request.form来获取,而用GET方法则用request.args来获取。


本文从http://www.jianshu.com/p/4350065bdffe转载



前端与后端的数据交互，最常用的就是GET、POST，比较常用的用法是：提交表单数据到后]]></description><category></category></item><item><title><![CDATA[关于input取不到值的可能性]]></title><link>https://blog.youkuaiyun.com/github_38854366/article/details/78363451</link><guid>https://blog.youkuaiyun.com/github_38854366/article/details/78363451</guid><author>github_38854366</author><pubDate>Fri, 27 Oct 2017 12:06:02 +0800</pubDate><description><![CDATA[首先总结:
如果$("#input").val()返回空值,只考虑两种可能:

1.没有定位到这个input;
2.有多个同标记的input;




今天给自己挖了个坑,div转对话框死活获取不到里面的值,框名什么的倒是很正常.
于是开始做测试,先是把input移除对话框外看是否能正常取到input里的值,结果正常.得出结论只能是对话框的锅.
再想,那到底是因为对话框弹窗设]]></description><category></category></item><item><title><![CDATA[理解pickle]]></title><link>https://blog.youkuaiyun.com/github_38854366/article/details/78351913</link><guid>https://blog.youkuaiyun.com/github_38854366/article/details/78351913</guid><author>github_38854366</author><pubDate>Thu, 26 Oct 2017 11:42:55 +0800</pubDate><description><![CDATA[表面上,pickle是一种存储的形式.
但是和word、txt等文本存储不一样,
举例来说:
假如我有一个class或者是list、truple之类的对象,
如果我直接保存在word,txt等文本中时,如果我要重新使用这个对象,我要先把已经字符化的对象重新对象化才能使用.
而如果用pickle.load()反序列化出来,则直接可以当做对象使用.
再举例来说:
如果有一串列表[1.2.]]></description><category></category></item><item><title><![CDATA[关于正则表达式的一些心得]]></title><link>https://blog.youkuaiyun.com/github_38854366/article/details/78351127</link><guid>https://blog.youkuaiyun.com/github_38854366/article/details/78351127</guid><author>github_38854366</author><pubDate>Thu, 26 Oct 2017 11:03:31 +0800</pubDate><description><![CDATA[match是从字符串首位开始查找,否则返回None
如果要找其他位置的字符,则用search为佳
match 和 search找到的字符要用group()取出来


findall返回的是一个包含所有符合要求的字符的列表,直接用切片的形式取字符就可以了.]]></description><category></category></item><item><title><![CDATA[关于flask-sqlalchemy同字段多条件的过滤方法]]></title><link>https://blog.youkuaiyun.com/github_38854366/article/details/77382480</link><guid>https://blog.youkuaiyun.com/github_38854366/article/details/77382480</guid><author>github_38854366</author><pubDate>Fri, 18 Aug 2017 18:59:13 +0800</pubDate><description><![CDATA[写在sqlalchemy/sql/operator.py里

举例来说如下


from operator import or_, and_, in_
from models import User


search_kw = "%abc%"

# 单关键字多字段查询
user = (User.query.filter(or_(User.name.like(search_kw),
        ...]]></description><category></category></item><item><title><![CDATA[werkzeug-Context Locals]]></title><link>https://blog.youkuaiyun.com/github_38854366/article/details/77155965</link><guid>https://blog.youkuaiyun.com/github_38854366/article/details/77155965</guid><author>github_38854366</author><pubDate>Mon, 14 Aug 2017 10:26:00 +0800</pubDate><description><![CDATA[原文：http://werkzeug.pocoo.org/docs/0.12/local/#werkzeug.local.LocalProxy


Sooner or later you have some things you want to have in every single view or helper function or whatever. In PHP the way t]]></description><category></category></item><item><title><![CDATA[python反射]]></title><link>https://blog.youkuaiyun.com/github_38854366/article/details/76577452</link><guid>https://blog.youkuaiyun.com/github_38854366/article/details/76577452</guid><author>github_38854366</author><pubDate>Wed, 02 Aug 2017 14:59:30 +0800</pubDate><description><![CDATA[啊哈，构思了很久，今天决定开个博客，把以后新学到的技能在博客里复述出来，加强记忆，方便查找。


导入非项目下的模块可以用这种方法：
import sys


sys.path.append('文件路径')
obj = __import__(‘路径下的文件名’)


已知字符串，要引用同名函数或类
func = getattr（'模块名'，'函数或类名的字符串形式'）
f]]></description><category></category></item></channel></rss>