Python内置函数(7)――bytearray
英文文档: class bytearray ( [ source [, encoding [, errors ] ] ] ) Return a new array of bytes. Theclass is a mutable sequence of integers in the range 0 <= x < 256. It has most of the usual methods...
View ArticleI like the Python 3 string .translate method
Suppose, hypothetically, that you wanted to escape the & character in text as a HTML entity: txt = txt.replace('&', '&') Okay, maybe there's a character or two more: ... txt =...
View Article分享一本Python进阶书籍
分享一本python进阶书籍 一点号编程派1小时前 国外 Python 博客不少,但经常更新的却不多。 Michael Driscoll 的 The Mouse vs. Python 算是其中一个。除了每周采访 Python 开发者,发布 PyDev of the Week 之外,还会定期写些入门教程和进阶教程。而且通过国外的自出版平台 Gumroad 和 Leanpub...
View ArticlePython 中的 property
使用 property 一般有以下两种方式 通过装饰器 class Demo(object): def __init__(self, val): self._x = val # 经过装饰器后,x 为 property对象 @property def x(self): # after some opertation return self._x # 调用 x 的setter方法(一个装饰器) 返回新的...
View ArticleDo Not Snap
DoNotSnap An experiment in detecting DoNotSnap badges in photos, to protect privacy. This program allows you to detect and identify DoNotSnap badges via a sliding-window decision tree classifier...
View ArticleCreate a Python Module
I wrote the module to parse an Oracle version string into what we’d commonly expect to see, like the release number, an “R”, a release version, and then the full version number. The module name is...
View ArticleUsing Rollbar: Capturing and Logging All Python Exceptions
I recently wrote an article about tracking user exceptions using Rollbar. For the article, I implemented an experiment using python. While I think Rollbar is a fantastic tool, I also think that in some...
View Article厉害了我的Python:STM32开发板制作红外加速度小车
python 现在无线控制已经成为了电子科学领域的主流,这次就来教大家做一个主流中的主流--无线控制的小车,先给大家看一下最终的成品演示图片: 首先介绍一下需要用到的材料: TPYBoardv102开发板两块 小车底盘一个 LORA无线模块两块 充电宝一个 9014三极管两个(为什么用到它呢,后面再说)。...
View ArticlepyJacqQ: Python Implementation of Jacquez's Q-Statistics for Space-Time...
Authors: Saman Jirjies, Garrick Wallstrom, Rolf U. Halden, Matthew Scotch Title: pyJacqQ: python Implementation of Jacquez's Q-Statistics for Space-Time Clustering of Disease Exposure in Case-Control...
View ArticleLintel Technologies: Writing shorthand statements in python
python is havingshorthand statements and shorthand operators. These things will help you write more logic with less number of statements. We will see those available shorthand statements. lambda...
View ArticleAnalyzing social networks using Python and SAS Viya
The study of social networks has gained importance over theyears within social and behavioral research on HIV and AIDS. Social network research can show routes of potential viral transfer, and be used...
View ArticleLintel Technologies: Python metaclasses explained
python is having obscure wonderfulmechanism of classes and it’s implementation. In python every thing is an object. If you define a class, that class it self is an object in memory and it is an...
View ArticleImport Python: ImportPython Issue 95
Worthy Read Fixing python Performance with Rust performance Excellent post from Armin Ronacher on tackling a CPython performance bottleneck with a custom Rust extension module. How to create read only...
View Articleansible作为python模块库使用
Asible是运维工具中算是非常好的利器,我个人比较喜欢,可以根据需求灵活配置yml文件来实现不同的业务需求,因为不需要安装客户端,上手还是非常容易的,在某些情况下你可能需要将ansible作为python的一个库组件写入到自己的脚本中,今天的脚本脚本就将展示下ansible如何跟python脚本结合,也就是如何在python脚本中使用ansible,我们逐步展开,先看第一个例子:...
View ArticleTinyDB: 使用Python编写的小型文档数据库
TinyDB是使用纯python编写的NoSQL数据库,它和SQLite数据库对应。SQLite是小型、嵌入式的关系型数据库,而TinyDB是小型、嵌入式的NoSQL数据库,它不需要外部服务器也没有任何依赖;使用json文件存储数据。 TinyDB源代码: https://github.com/msiemens/tinydb TinyDB文档:...
View ArticleUpgrading Django
For the second time in a few years I've found myself doing a number of Django upgrades. It's a good thing: I'm happy the framework I chose to base most of my work on when I went solo has stayed...
View Article使用 OpenCV 裁剪 PDF 页面
网上找到的一些课件讲义等资料有时候会是 PPT 多页打印而成的 PDF 文件,比如下图这种: 有些人希望对 PDF 页面进行裁剪,将 PDF 还原为原 slides 那样一页一张演示文稿的形式。(其实我个人觉得没什么必要,因为不影响阅读,而且 PDF 格式读起来还不用频繁翻页了。) 前几天,我在知乎上看到了有这样需求的 一个问题 。 当时想到用 python 和 OpenCV...
View ArticleHow To Implement Baseline Machine Learning Algorithms From Scratch With Python
It is important to establish baseline performance on a predictive modeling problem. A baseline provides a point of comparison for the more advanced methods that you evaluate later. In this tutorial,...
View ArticleLazy tree walking made easy with coroutines
Let's imagine a simple unbalanced binary tree structure, in which an abstract BinaryTree<E> is either a concrete Node with a value attribute of type E and a left and right subtree, or a concrete...
View Article浅析Python中__new__函数
python是面向对象的程序设计语言,Python把所有东西都被视作对象。 Python中有一类特殊的方法,即魔术方法-Magic Method(带两个 __ 的方法),如 __new__ 、 __init__ 。 要想理解 __new__ ,我们还要搞懂 __init__ 。 __init__ 方法是在初始化一个类实例的时候调用,但 __init__...
View Article