![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
二儿娃
这个作者很懒,什么都没留下…
展开
-
Ipython debug
Steps are:1. Install ipython 2. Add the import in your codes:" from IPython.core.debugger import Tracer; debug_here = Tracer() " or "from IPython.debugger import Tracer; debug_here = Tracer() "原创 2013-08-05 17:41:01 · 1534 阅读 · 0 评论 -
PYthon类的定义、继承以及使用对象(例)
Python编程中类的概念,可以比作是某种类型的集合的描述,如“人类”可以被看作是一个类, 然后用人类这个类定义出每个具体的人——你、我、他等作为其对象。类还拥有属性和功能,属性即类本身的一些特性, 如人类有名子、身高和体重等属性,而具体值则会因人而异;功能则是类所能实现的行为,如人类拥有走路、吃饭、睡觉等功能。具体形式如下:# 例:类的概念class 人类: 名字 =转载 2013-11-11 12:51:25 · 625 阅读 · 0 评论 -
pickle 用法 reference
http://oldj.net/article/python-pickle/写的比较清楚, 而且有例子.http://docs.python.org/2/library/pickle.html#module-cPicklePython官方的介绍原创 2013-11-28 12:27:34 · 336 阅读 · 0 评论 -
一个很好的Python library reference
http://docs.python.org/2.3/lib/typesmapping.html原创 2013-11-28 22:53:59 · 808 阅读 · 0 评论 -
Python: .encode方法
官方教程: http://docs.python.org/2/howto/unicode.html方法.encode([encoding], [errors='strict']), 返回一个 8-bit string version of the Unicode string, encoded in the requested encoding.The errors p翻译 2013-11-29 16:53:55 · 608 阅读 · 0 评论 -
Python: Sort a dictionary by value
http://stackoverflow.com/questions/613183/python-sort-a-dictionary-by-valueimport operatorx = {1: 2, 3: 4, 4:3, 2:1, 0:0}sorted_x = sorted(x.iteritems(), key=operator.itemgetter(1))转载 2013-12-10 23:00:06 · 1189 阅读 · 0 评论 -
python3-postgresql
import pg (postgres) in python codes, you need to install 'python3-postgresql'or search it as follows:$ sudo apt-cache search python3-postgresql原创 2013-11-18 21:34:53 · 2167 阅读 · 0 评论