How to Create Django Admin List Actions
Django Admin list actions are meant to be used to perform operations in bulk. All Django Admin list views already come with a default action “Delete selected <ModelName>s”. In this short tutorial...
View ArticlePlotting Using an MPP Database
Data visualization is the process of transforming and condensing data into an easily digestible graphic. It is crucial in helping data scientists understand their data and share their insights with...
View ArticleTwo (or Three?) Tips to Improve AWS SQS Throughput
I have software that is processing approximately 200k records per 5 minutes from SQS. That’s about 40k/ minute, or 666 records per second. Not bad! The only problem is, I had to run 25 instances of my...
View ArticlePython 日志模块 logging 详解
Java 中最通用的日志模块莫过于 Log4j 了,在 python 中,也自带了 logging 模块,该模块的用法其实和 Log4j 类似。 Python 使用logging模块记录日志涉及四个主要类,使用官方文档中的概括最为合适: logger提供了应用程序可以直接使用的接口; handler将(logger创建的)日志记录发送到合适的目的输出;...
View ArticlePython cx_Oracle Adds Direct Binding
python cx_Oracle Adds Direct Binding Written by Kay Ewbank Wednesday, 15 March 2017 Oracle has released a new version of the Python interface for Oracle Database. The new version supports Python 3.6...
View ArticleNginx+uWSGI+Django环境搭建过程分享
如何搭建一个线上的Django环境,对于这种问题,一般本能的感觉是不难,网上肯定一堆资料,照着敲就可以了,所以很多人直接回复的是,上网上查,自己都快被网上的资料整崩溃了,看了几十篇没一个能按着步骤搭建完成的,网上的内容第一同质化内容太严重,基本你看一篇其它都不用看了,基本都一样,另外最最主要的是文章内容没有价值,因为10篇有9篇都是很久以前的文章,就现在这IT技术的发展,尤其是使用开源的东西,基本每...
View ArticleNumpy Vs Pandas Performance Comparison
Interesting performance comparisons between pandas and numpy Pandas and Numpy are two packages that are core to a lot of data analysis. In this post I will compare the performance of numpy and pandas....
View Article当python爬虫遇到10060错误
相信做过网站爬虫工作的同学都知道,python的urllib2用起来很方便,使用以下几行代码就可以轻松拿到某个网站的源码: #coding=utf-8 import urllib import urllib2 import re url = "http://wetest.qq.com" request = urllib2.Request(url) page =...
View ArticlePython3 实现美女图片爬虫
实验楼 2017-03-15 10:57 阅读 16 收藏 1 推荐 2 项目简介:本实验通过使用 python 实现一个淘宝女郎图片收集爬虫,学习并实践 BeautifulSoup、Selenium Webdriver 及正则表达式等知识。 每一个老司机都和这门课相见恨晚。只要20分钟,8个多G的美女图片就会按文件夹、姓名、地点整整齐齐地出现在你的电脑里。单身狗看了会流泪,宅男看了会沉默。...
View ArticlePython自动化开发(三):循环次数控制、常用数据类型、字符串格式化、列表常用操作、列表 ...
计数器的作用可以在死循环中,符合条件的情况下做自动退出中断 #!/usr/bin/env python # _*_ coding: utf-8 _*_ # @Time : 2017/3/14 11:23 # @Author : eason # @File : guest_lucknum.py.py lucky_num = 19 input_num = -1 guset_num = 0 while...
View ArticleArguments to Python generatorfunctions
In python, a generator function is one that contains a yield statement inside the function body. Although this language construct has many fascinating use cases ( PDF ), the most common one is...
View ArticleDjango使用Social-Auth实现微信第三方网站扫码登录
前言 之前让网页公司制作新官网的时候规划有 第三方账号 的登录功能,但由于当时的一些开放平台申请步骤比较繁琐(尤其是微信开放平台),所以一直拖延着,到了最近只能自己添加相关的功能。 由于是刚接触 python 和 Django ,期间找了好多视频和资料学习练习,才慢慢把 MVT结构 什么的弄明白了,第三方登录方面百度找到了两篇很有用的文章,也从中学习到了很多: 1....
View ArticlePyBites: 10 Tips to Get More out of Your Regexes
Regular expressions can be arcane, yet when used with care they can also be very powerful. In this post a couple of tips to get the most out of your regexes when using python's re module. Some people,...
View Articlepython爬虫――爬取知乎上自己关注的问题
欢迎加入 python 学习交流群:535993938 禁止闲聊 ! 名额有限 ! 非喜勿进 ! 与 之前爬的网站图片的不同的是,现在爬取的是要自己个人的关注的东西,所以需要做到模拟登录。模拟登录的原理是登录网站后,在浏览器上获取保存的cookies信息,填充之后与请求一起发送。 如果前面的爬取图片的会爬取了,对于这个解析字符串的也没有多大问题了。...
View Article计算机科学家眼中的Python程序之道
计算机科的思考方式综合了数学、工程学以及自然科学的一些最优秀的特性。计算机科学家与数学家类似,他们使用形式语言来描述理念(特别是计算);与工程师类似,他们设计产品,将元件组装成系统,对不同的方案进行评估选择;与自然科学家类似,他们观察复杂系统的行为,构建科学假说,并检验其预测。...
View ArticlePython 函数中,参数是传值,还是传引用?
在 C/C++ 中,传值和传引用是函数参数传递的两种方式,在python中参数是如何传递的?回答这个问题前,不如先来看两段代码。 代码段1: def foo(arg): arg = 2 print(arg) a = 1 foo(a) # 输出:2 print(a) # 输出:1 看了代码段1的同学可能会说参数是值传递。 代码段2: def bar(args): args.append(1) b =...
View Article[工具资源] 只需两行,在你的微信上监控 Python 程序
不知道大家有没有过这样的经历: 电脑上跑着代码,人走开了,在外面特别挂念,想知道那代码跑得怎样了… 写了个小程序,监控某个网页的变化,但没有比较实时的通知方式,邮件太重、短信又不好搞 在过去,这样的问题有时会困扰我。 不过现在,可以把警告/日志发到我的微信上。 from wxpy import get_wechat_logger # 获得 Logger logger =...
View Article