Programming Foundations with Python
Source Programming Foundations with python Function create python file some_module.py make function inside this file, define function via def do_this(params): do something use function anywhere,...
View Article如何使用 NotImplemented
version python3.5.3 NotImplemented 是 Python 中的一个内建常量,文档中表述如下 This object is returned from comparisons and binary operations when they are asked to operate on types they don’t support. See Comparisons...
View ArticleBlack Hat Python
出版时间:2014.9 官网链接: No Starch Press 下载地址: 百度网盘(PDF+EPUB+MOBI) 内容简介: When it comes to creating powerful and effective hacking tools, python is the language of choice for most security analysts. But just...
View ArticlePython 多进程导入数据到 MySQL
前段时间帮同事处理了一个把 CSV 数据导入到 mysql 的需求。两个很大的 CSV 文件, 分别有 3GB、2100 万条记录和 7GB、3500 万条记录。对于这个量级的数据,用简单的单进程/单线程导入 会耗时很久,最终用了多进程的方式来实现。具体过程不赘述,记录一下几个要点: 批量插入而不是逐条插入 为了加快插入速度,先不要建索引 生产者和消费者模型,主进程读文件,多个 worker...
View Article测试开发之路:英雄迟暮,我心未老
前言 最近朋友圈里风风火火的,先是华为裁撤34岁以上交付员工的新闻刷了我的屏,然后有人发在朋友圈招聘测试人员声称不要6年以上的又吵了个沸沸扬扬的,这两天又有一堆人在脉脉里提问5年的功能测试人员该怎么办。本来我对这些并没有直观上的感受,工作挺忙的,一有时间就跑去陪待产的女王大人了,所以也没太在意这些。直到前两天面试到一位10年的老QA后,我才深深的感慨了一番。 背景...
View ArticleDjango Weekly 27 - Advanced Django querying, Django Signals, Elasticbeanstalk...
Worthy Read Advanced Django querying: sorting events by date Application of Django's Case, When queryset operators for sorting events by date. orm , Query Find Top Developers We help companies like...
View ArticlePython元类(小李很悲剧)
python元类 最近一直在写Python代码,但是每创建一个类,都要重新写一套set和get方法,麻烦的要死,而且每加一个新成员都要配套一堆相关方法,真的很浪费时间,如果能把这些时间统统节省下来,那必是极好的。 在Python中有“元类”的概念,其作用就是动态创建一个类,包括其成员以及相应方法。基于元类,可以快速生成一个新类,并自动生成一些常用的工具方法,以节省时间。...
View ArticleAI学习之路(10): 张量的常量2
tf.fill(dims, value, name=None) 创建一个张量填充指定的常数。 参数: dims: 整数类型的列表对象,或者一维张量,表示行列形式。 value: 填充的常量( 0 维张量) 返回值: 填充指定的张量常量。 例子: #python 3.5.3 蔡军生 #http://edu.csdn.net/course/detail/2592 # import tensorflow...
View ArticleImport Python: ImportPython 113 - Interview with Guido aka BDFL
Interview with Guido van Rossum Talkpython interview with Guido van Rossum aka BDFL. podcast , BDFL Find Top Developers We help companies like Airbnb, Pfizer, and Artsy find great developers. Let us...
View ArticleJaime Buelta: Compendium of Wondrous Links vol XI
It has been a while since the last time. More food for though! python Python 3 upgrade strategy . The time has come to take migrating to python 3 seriously. Another addition to Python-to-c++ compilers,...
View Article使用flask-sqlalchemy玩转MySQL
每个项目都离不开数据库,所以要是打算用Flask写一个程序,自然也离不开flask-sqlalchemy。作为一个mysql DBA,当然会首选MySQL作为程序的数据库,毕竟我擅长于此。那么就来总结下,怎么用flask-sqlalchemy来玩转MySQL吧。 安装命令 pip install mysql-python pip install flask-sqlalchemy...
View ArticlePython多线程入门指南
一直懒得写python相关的文章,恰好有天需要简单的给童鞋们讲点课,仓促之余就诞生了此文. 今天本来准备全面的聊聊有关高性能并发这个话题来着,但是周末马上要来了啊.所以我就取了其中的一点来介绍,关于其他的方面,有兴趣的小伙伴可以和我交流.谈高效并发,往往脱离不了以下三种方案:...
View Articleunittest.mock small gotcha - a humbling tale of failure
Developing a small web application I recently had reason to upgrade from python 3.4 to Python 3.6. The reason for the upgrade was regarding ordering of keyword arguments and not related to the bug in...
View ArticleMachine Learning from scratch. Bare bones implementations in Python
Machine Learning From Scratch python implementations of various Machine Learning models and algorithms from scratch. While some of the matrix operations that are implemented by hand (such as...
View ArticleScreenshots with SnapClip
February 25, 2017 at 12:55 PM by Dr. Drang I’ve been writing and rewriting this screenshot script/workflow/thingsince 2006. Every now and then I have an idea of how to improve it, and I inflict the...
View ArticleAutomate finding misspellings in source code
Typos and misspellings in code can be difficult. Finding them and keeping them out takes vigilance. Lots of mental energy wasted. The misspellings tool written in python can be installed using pip...
View Articlequtebrowser development blog: qutebrowser v0.10.0 released
I'm happy to annouce the release of qutebrowser v0.10.0! qutebrowser is a keyboard driven browser with a vim-like, minimalistic interface. It's written using PyQt and cross-platform. I haven't...
View ArticleAI学习之路(9): 张量的常量1
上一次我们学习了张量的变量,在这一次来学习一下张量的常量,因为很多时候需要使用张量常量来初始化变量,并且产生一些常量是固定的初始化值,这样可以减少变量的出错,同时也提供很好的测试数据,比如产生一个正态分布的数据,又或者产生初始化为 0 值,或者 1 值等等。 tf.zeros(shape, dtype=tf.float32, name=None) 产生零值常量的张量类。 参数 : shape:...
View ArticlePython学习记录day7
title: python学习记录day7 tags: python author: Chinge Yang date: 2017-02-18 --- Python学习记录day7 @(学习)[python] [TOC] 1. 面向过程 VS 面向对象 编程范式 编程是程序员用特定的语法+数据结构+算法组成的代码来告诉计算机如何执行任务的过程 ,...
View Article面试 | Python面试题目及答案(一)
面试 | python面试题目及答案(一) 一点号书圈4小时前 php?url=0FjY4YHlbv" alt="面试 | Python面试题目及答案(一)" />题目整理来自网络。 问题一:以下的代码的输出将是什么? 说出你的答案并解释。 答案 以上代码的输出是:使你困惑或是惊奇的是关于最后一行的输出是 3 2 3 而不是 3 2 1。为什么改变了 Parent.x 的值还会改变...
View Article