Python-Socket-Programming(1)

2017-01-29
阅读 12 分钟
2k
Sockets are used nearly everywhere, but are one of the most severely misunderstood technologies around. This is a 10,000 foot overview of sockets. It’s not really a tutorial - you’ll still have work to do in getting things operational. It doesn’t cover the fine points (and there are a lot of them...

Python-logging

2017-01-29
阅读 5 分钟
1.6k
The logging functions are named after the level or severity of the events they are used to track. The standard levels and their applicability are described below (in increasing order of severity):

Python-Django-memcached

2017-01-29
阅读 4 分钟
2.4k
After installing Memcached itself, you’ll need to install a Memcached binding. There are several Python Memcached bindings available; the two most common are python-memcached and pylibmc.

GitHub-Multiple-Account

2017-01-25
阅读 2 分钟
1.8k
由于linux下面一个用户只拥有一个自己的公钥和私钥,所以无法同时在两个不同的GitHub账号上面设置相同的ssh key,所以最简单的办法就是新建一个用户,然后这个新建的用户生成自己的ssh key。但是还有另外一种更加优雅的方式。

Django-REST-Framework(1)

2017-01-25
阅读 5 分钟
2.6k
We're going to create a simple API to allow admin users to view and edit the users and groups in the system.

Python-Decorator

2017-01-25
阅读 3 分钟
1.5k
The problem is that the statement count += 1 actually means the same as count = count + 1, when count is a number or any immutable type. So we are actually assigning to count in the body of averager, and that makes it a local variable. The same problem affects the total variable.

Python-SQLALchemy

2017-01-25
阅读 23 分钟
5.9k
官方文档 Initialization {代码...} {代码...} 正式创建数据表 {代码...} Creating a Session 下面的操作都是要通过会话对象操作 {代码...} Adding and Updating Objects 添加一个User对象 {代码...} 查询一下,使用filter_by来过滤,first只列出第一个查询到的对象 {代码...} 使用add_all,一次性添加多个对象 {代码......

Python-MySQLdb

2017-01-25
阅读 2 分钟
1.6k
因为这里是要插入数据,所以要commit,但是我不进行commit好像也没有问题。我查阅到的资料的解释是,当curosr.execute()执行成功的时候,执行conn.commit(),但是执行失败的时候,就执行conn.roolback(),跟hibernate一样,应该也是进行事务的回滚。还有一点,有的教程说应该设置conn.autocommit(False)来关闭自动提交事...

Python-Virtualenv

2017-01-25
阅读 3 分钟
3.7k
在使用virtualenv前ubuntu默认的解释器是python2.7,而且/usr/lib/python3里面已经安装好了ipython3和requests

Python-Django

2017-01-23
阅读 10 分钟
2.1k
准备工作 新建一个Django项目 {代码...} 项目的结构 {代码...} {代码...} {代码...} 一般在urls.py中配置url,在models.py中配置model,在views.py中配置View。 urls.py Function views {代码...} Class-based views {代码...} Including another URLconf {代码...} {代码...} 使用(?P<>d+)的形式捕获值给<>...