- 博客(18)
- 收藏
- 关注
转载 python 单例实现
class View: _instance = None def __new__(cls, *args, **kwargs): if cls._instance is None: cls._instance = super(View, cls).__new__(cls) return cls._instance...
2017-10-11 12:44:00
84
转载 logging 简单使用
import logging logging.basicConfig( level=logging.DEBUG, format='[%(asctime)s <%(filename)s :%(lineno)d>] [%(levelname)s] %(message)s', datefmt='%Y-%m-%d %H:%M:%S', # 日志输出到...
2017-05-29 21:38:00
91
转载 CTypes
参考:http://docs.pythontab.com/interpy/c_extensions/ctypes/ Python中的ctypes模块可能是Python调用C方法中最简单的一种。ctypes模块提供了和C语言兼容的数据类型和函数来加载dll文件,因此在调用时不需对源文件做任何的修改。也正是如此奠定了这种方法的简单性。 示例如下 实现两数求和的C代码,保存为add.c //s...
2017-05-29 13:08:00
126
转载 类装饰器使用
参考:http://docs.pythontab.com/ from functools import wraps class logit(object): def __init__(self, logfile='out.log'): self.logfile = logfile def __call__(self, func): @w...
2017-05-29 10:55:00
77
转载 Django admin
Django admin的设置 1.setting.py配置 DATABASES = { # # 'default': { # 'ENGINE': 'django.db.backends.sqlite3', # 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), # } 'defau...
2017-05-29 00:10:00
68
转载 Django 视图
项目创建 python s.py djangoproject usr_app 创建后的目录截图如下 urls.py设定 #djangoproject的urls.py指向app_user的urls.py--namespace:模块名 from django.conf.urls import include, url from django.contrib import admin u...
2017-05-28 23:39:00
65
转载 单例模式
单例模式 class TestSingle(object): """使用父类的new方法初始换一个实例。 new方法会自动接收类创建时的参数,所以要设定不定长的参数 """ def __new__(cls, *args, **kwargs): if not hasattr(cls, "_instance"): ...
2017-05-28 18:21:00
56
转载 reduce/filter/map/zip/isinstance/list列表推导式
转载于:https://www.cnblogs.com/by2016/p/6914730.html
2017-05-27 23:21:00
68
转载 shell
NAME=100 定义局部变量 export NAME=100 定义环境变量 unset NAME 清除变量 echo 查看字符串 env 查看环境变量 $() ...`` $((NAME+10)) $[2#10+7] \:转义 转载于:https://www.cnblogs.com/by2016/p/6907019.html...
2017-05-26 09:43:00
43
转载 安装Redis
一、安装Redis 安装Redis:http://redis.io/download 安装完成后,拷贝一份Redis安装目录下的redis.conf到任意目录,建议保存到:/etc/redis/redis.conf(Windows系统可以无需变动) 二、修改配置文件 redis.conf 打开你的redis.conf配置文件,示例: 非Windows系统:su...
2017-05-16 00:50:00
59
转载 git秘钥生成
#修改git配置 vi .gitconfig #生成秘钥 ssh-keygen -t rsa -C "邮箱地址" #查看秘钥 cat id_rsa.pub 转载于:https://www.cnblogs.com/by2016/p/6854581.html
2017-05-15 00:12:00
84
转载 联合查询
select department.name from employee inner join department on departmentld=department.id group by departmentld order by avg(salary) desc limit 0,3; 查询不同部门的工资的前三名 create view salary_vi...
2017-05-08 21:28:00
71
转载 python 排序之sort
#coding:utf-8 #求列表的第二大值 list_test =[6,2,4,6,1,2,3,4,5] list_test.sort() print list_test[-2] """6""" help(list_test.sort) """Help on built-in function sort: sort(...) L.sort(...
2017-05-08 18:58:00
99
转载 python3-asyncio异步爬虫测试(无注释demo)
#!/usr/bin/python3 "this is a spider" import re import asyncio import urllib.request, urllib.parse, urllib.error import http.cookiejar async def html(urlAddr): req = url...
2017-02-26 17:21:00
155
转载 python3 asyncio-协程模块测试代码
import time import asyncio #统计运行时间的装饰器 def run_time(func): def wrapperfunc(*argv, **kwargv): now = lambda : time.time() start = now() func(*argv, **kwargv...
2017-02-23 16:11:00
78
转载 VIM --使用进阶 -- 插件篇 -- YouCompleteMe -- nerdtree
系统:ubuntu: 资源:https://github.com/ 其他:想了解都要哪些好用的插件,推荐大家读http://blog.csdn.net/mergerly/article/details/51671890 这个博客的内容很赞。 vim本身是一个非常优秀的编辑器,为了提升使用流畅感,增加一些功能,就需要安装一些插件,先放一张个人常用的vim界面截图。左侧可以快速...
2017-02-16 13:00:00
119
转载 R语言爬虫 rvest包 html_text()-html_nodes() 原理说明
library(rvest) 例子网页:http://search.51job.com/jobsearch/search_result.php?fromJs=1&jobarea=010000%2C00&funtype=0000&industrytype=00&keyword=%E6%95%B0%E6%8D%AE&keywordtyp...
2016-07-09 19:21:00
2790
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人