自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(10)
  • 资源 (1)
  • 收藏
  • 关注

原创 装饰器实现单例模式

使用装饰器实现单例程模式def singleton(cls, *args, **kw): instances = {} def _singleton(): if cls not in instances: instances[cls] = cls(*args, **kw) return instances[cls] r...

2018-06-24 14:15:06 766

原创 打印程序运行时间

用装饰器实现打印程序运行时间import timedef print_run_time(func): def wrapper(*args, **kw): start = time.time() func(*args, **kw) end =time.time() - start print "run time is %s"...

2018-06-24 13:54:48 751

原创 python实现基本算法

1. 冒泡排序本文采用两种方法进行冒泡排序,第一种:第一次排序后,数组中的第一个元素最小def bubble_sort(lists): # 冒泡排序 count = len(lists) for i in range(count): for j in range(i + 1, count): if lists[i] &g...

2018-06-22 21:37:49 239

原创 Golang study

Useful URLhttps://golang.org/https://play.golang.org/https://atom.io/https://github.com/nsf/gocode

2018-06-13 09:11:06 228

原创 apps

keep apps small and simpleapps can be reused between projects

2018-06-05 06:09:30 173

原创 subprocess

import subprocess_VERBOSE = Truedef run_cmd(cmd): if _VERBOSE: print cmd process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIP...

2018-06-04 16:08:10 607

原创 contextlib

>>> import contextlib>>> @contextlib.contextmanager... def make_context():... print 'enter'... try:... yield {}... except RuntimeError, err:... pri...

2018-06-04 10:29:00 516

原创 dictionary

>>> a = {"1":"WuWei"}>>> name = a.pop('2', [])>>> name[]>>> name = a.pop('2')Traceback (most recent call last): File "<stdin>&

2018-06-03 19:03:09 186

原创 set and frozenset

>>> x = set("A Python")>>> xset(['A', ' ', 'h', 'o', 'n', 'P', 't', 'y'])Sets are implemented in a way, which doesn't allow mutable objects.>>> name = set((["name1", &amp

2018-06-03 17:44:08 141

原创 textwrap

dedent  it’s the design of textwrap.dedent: On the first line you have to set the ammount of space you want to dedent in the lines below, otherwise it will capture the position of the first text to se...

2018-06-03 09:01:15 203

gcc中文手册

gcc compile parameter explain, It's very useful for study build code using linux

2015-01-28

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除