The easy (and nice) way to do CLI apps in Python
There are a few ways to do the command-line app thing in python. I’ve done these few ways, and some of them have their pain-points and annoyances. So I reached out to the community to find what the...
View ArticleCatalin George Festila: Using text file with python 2.7 .
This simple tutorial is about text file. The text file come with txt extension. It is a file containing text that can be used and further processing by functions and modules python. I used Tkinter...
View ArticlePython内置函数(14)――delattr
英文文档: delattr ( object , name ) This is a relative of. The arguments are an object and a string. The string must be the name of one of the object’s attributes. The function deletes the named attribute,...
View ArticlePython正则表达式:最短匹配
最短匹配应用于:假如有一段文本,你只想匹配最短的可能,而不是最长。 例子 比如有一段html片段,'\ this is first label\ \ the second label\ ',如何匹配出每个a标签中的内容,下面来看下最短与最长的区别。 代码 >>> import re >>> str = '<a>this is first...
View ArticlePython 进阶_OOP 面向对象编程_类和子类
目录 类 类是实例的抽象, 实例是类的具体化.python 中的类分为 经典类 和 新式类 . 前者现在已经很少用到了, 其特点就是可以不需要继承任何父类;后者则刚好相反, 形式类必须至少有一个父类, 如果没有特定的父类需要继承时, 至少需要继承基类 object , 在后面给出例子. 最简单的类 一个最简单的类可以不具有任何的函数, 仅仅是用作生成一个命名的空间. In [1]: class...
View Article利用 Python 进行数据分析学习笔记(三)
前面两篇文章分别讲了 python 数据分析的模块安装和数据结构,本篇主要讲如何利用 Python 进行简单的绘图。绘图的主要模块是 Matplotlib,其优势如下: 画图质量高 方便快捷地绘制模块 绘图API ―― pyplot 模块 集成库 ―― pylab 模块(包含 NumPy 和 pyplot 中的常用函数) 一、基本绘图 import numpy as np import...
View ArticleJSON Web Tokens in django application- part two
First, there is a need to create model for Task: from django.db import models from django.contrib.auth.models import User class Task(models.Model): title = models.CharField(max_length=100) person =...
View ArticlePlone on python 3 status
2020 is approaching fast, one day at a time, and besides being a nice catchy year, it will be also the year where python 2.7 will no longer get any security updates . What that means for Plone?We...
View ArticlePython 进阶_OOP 面向对象编程_类属性和方法
目录 类属性 在理解类属性之前要先搞清楚 实例属性 和 函数属性 之间的区别: 1. 实例属性:指的是实例化类对象的属性,需要在类中使用 self 关键字来将其和实例化对象绑定的属性。 2. 函数属性:指的是定义在函数体内的属性,其可以是实例属性,也可以是类属性。 3. 类属性:是一个与实例无关的属性,比起实例属性而言,它更加的 静态...
View ArticlePython内置函数(15)――dict
英文文档: class dict ( **kwarg ) class dict ( mapping , **kwarg ) class dict ( iterable , **kwarg ) Return a new dictionary initialized from an optional positional argument and a possibly empty set of...
View Article用 Django 来响应 Github Webhook
由瞳人 发布于 June 20, 2016, 4:44 p.m. 16 个评论 Django Github 利用 Django 来响应 Github 的 webhook 请求. 由于本 vps 上的 gitlab 开销大,所以我把所有项目移到 github 上。因此原先针对 gitlab 的 webhook 代码 就需要更新了。 关于 github webhook...
View Article[译]理解python的metaclass
理解python的metaclass(元类) 前言 这篇博客是我在stack overflow上看了一个提问回复后写的,例子基本用的都是e-satis本人的例子,语言组织也基本按照翻译来。 但我并不是一个翻译者,并不会严格遵守每行每句的翻译; 有时候我会将表述换个顺序,省略一些我认为无关紧要的话,以便读者更好理解。 所以,如果你不喜欢我的语言表述,或者想要看英文原文,可以 点击此链接 去查看原回复。...
View Article理解python的metaclass
理解python的metaclass 2小时前来源:51CTO 前言 这篇博客是我在stack overflow上看了一个提问回复后写的,例子基本用的都是e-satis本人的例子,语言组织也基本按照翻译来。 但我并不是一个翻译者,并不会严格遵守每行每句的翻译;有时候我会将表述换个顺序,省略一些我认为无关紧要的话,以便读者更好理解。...
View ArticlePython 学习笔记 - socketserver源代码剖析
前面学习的例子都是单线程的socket收发;如果有多个用户同时接入,那么除了第一个连入的,后面的都会处于挂起等待的状态,直到当前连接的客户端断开为止。 通过使用socketserver,我们可以实现并发的连接。 socketserver的使用很简单: 首先看个简单的例子 服务端: 自己定义一个类,继承socketserver.baserequesthandler; 然后定义一个方法 handle()...
View ArticlePython内置函数(16)――dir
英文文档: dir ( [ object ] ) Without arguments, return the list of names in the current local scope. With an argument, attempt to return a list of valid attributes for that object. If the object has a...
View Article9 reasons you should be using PyCharm
On my podcast, Talk python To Me , I’m working on an episode highlighting PyCharm , the amazing IDE from JetBrains. Here’s a blog post to accompany that episode. Update: Listen to the podcast...
View ArticlePyMoneroWallet: the Python library for the Monero wallet
Do you know the Monero crytocurrency? It’s a cryptocurrency , like Bitcoin , focused on the security, the privacy and the untracabily . That’s a great project launched in 2014, today called XMR on all...
View ArticleDive into Machine Learning with Python Jupyter notebook and scikit-learn
Dive into Machine Learning Hi there! This guide is for you: You're new to Machine Learning. You know python. (At least the basics! If you want to learn more Python, try this ) I learned Python by...
View Article5 wicked-fast Python frameworks you have to try
Faster, simpler, more "pythonic" -- those are the rallying cries for each new web framework in the Python ecosystem. There's nothing wrong with tried-and-true solutions, but the big leap from Python 2...
View Article快到飞起!值得一试的五大新Python框架
快到飞起!值得一试的五大新python框架 2小时前来源:IT168 【IT168 资讯】Python提供的web框架为码农创新设计做了很多贡献,使web开发越来越方便。从第二版到第三版,Python开启了众多隐藏技能,如果你认为老的Python网络框架不够快或网络库不够用的话,你可以试试以下这五个快到飞起的网络框架。每一个新的网络框架,在速度和实用性上似乎更胜一筹。...
View Article