
Python
少言才不会咸
这个作者很懒,什么都没留下…
展开
-
Python Hook
# -*- coding: utf-8 -*- # import pythoncom import pyHook def onMouseEvent(event): # 监听鼠标事件 print "MessageName:",event.MessageName print "Message:", event.Message print "Time转载 2017-05-31 11:15:08 · 4521 阅读 · 0 评论 -
Python3的concurrent.futures模块
import concurrent.futuresimport mathPRIMES = [ 112272535095293, 112582705942171, 112272535095293, 115280095190773, 115797848077099, 1099726899285419]def is_prime(n): i...翻译 2018-07-04 22:51:25 · 1075 阅读 · 0 评论 -
python3标准库httpclient使用
import http.client, urllib.parsedef get_demo(): params = urllib.parse.urlencode({'mode': 'get', 'func': 2}) headers = {"Content-type": "application/x-www-form-urlencoded", &am原创 2018-07-02 23:00:37 · 15248 阅读 · 0 评论 -
Python元类使用之ORM原理
# _*_ coding: utf-8 _*_class Field(object): def __init__(self, name, column_type): self.name = name self.column_type = column_type def __str__(self): return '<%s...转载 2018-05-08 13:46:26 · 503 阅读 · 0 评论 -
python设计模式:适配器模式
class Synthesizer: def __init__(self, name): self.name = name def __str__(self): return 'the {} synthesizer'.format(self.name) def play(self): return 'is playing ...原创 2018-05-08 10:47:21 · 175 阅读 · 0 评论 -
类实例函数的的装饰器
def required_login_1(func): def wrapper(request,*args,**kwargs): func(request,*args,**kwargs) print(request.name) return wrapperdef required_login_2(func): def wrapper(*a...原创 2018-03-30 00:06:28 · 341 阅读 · 0 评论 -
python 爬虫模拟登陆
# _*_ coding: utf-8 _*___author__ = 'willxin'__date__ = '2017/8/24 12:50'from time import sleepimport urllibimport urllib2import cookielibimport PyV8from bs4 import BeautifulSoupimport md5util原创 2017-10-23 20:24:18 · 838 阅读 · 0 评论 -
Python 爬虫163Music
【代码】Python 爬虫163Music原创 2017-10-23 20:26:16 · 694 阅读 · 0 评论 -
Pythonic QuickSort
import randomdef QuickSort(arr): if len(arr) <= 1: return arr pivot = arr[-1] pivots = [ i for i in arr if i==pivot ] left = QuickSort([ i for i in arr转载 2017-09-21 22:17:24 · 322 阅读 · 0 评论 -
Django1.9.8项目配置
=======================主settings文件=========================# 配置时区LANGUAGE_CODE = 'zh-hans'TIME_ZONE = 'Asia/Shanghai'# Static files (CSS, JavaScript, Images)# https://docs.djangoproject.com/en/1.9/h原创 2017-09-23 21:55:27 · 850 阅读 · 0 评论 -
Python 加 tab
#python加tab#python startup fileimport sysimport readlineimport rlcompleterimport atexitimport os#tab completionreadline.parse_and_bind('tab: complete')# history file for Linuxhistfile = os.p转载 2017-05-31 22:25:19 · 439 阅读 · 0 评论 -
python设计模式:链式建造者模式
class Pizza: def __init__(self, builder): self.garlic = builder.garlic self.extra_cheese = builder.extra_cheese def __str__(self): garlic = 'yes' if self.garlic else 'no' cheese = 'yes' if s...转载 2018-10-22 15:13:42 · 245 阅读 · 0 评论