会员
周边
新闻
博问
闪存
赞助商
YouClaw
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Howhy Blogs
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
17
18
19
20
21
22
23
24
25
···
41
下一页
2017年11月11日
Django的信号机制详解
摘要: Django提供一种信号机制。其实就是观察者模式,又叫发布-订阅(Publish/Subscribe) 。当发生一些动作的时候,发出信号,然后监听了这个信号的函数就会执行。 Django内置了一些信号,比如: django.db.models.signals.pre_save 在某个Model保存之
阅读全文
posted @ 2017-11-11 13:58 howhy
阅读(950)
评论(0)
推荐(0)
2017年11月5日
python 单例模式
摘要: class SingleObj(): __singleobj=None @classmethod def get_singleinstance(cls): if not cls.__singleobj: cls.__singleobj=SingleObj() return cls.__singleobj obj1=S...
阅读全文
posted @ 2017-11-05 16:18 howhy
阅读(157)
评论(0)
推荐(0)
python raise assert
摘要: PS D:\python\py_test> python3 .\t1.py 手动触发exceptionerror: 出错了 print(123) assert 1==1##若成立则执行后面的代码 反之直接报错 print(456)
阅读全文
posted @ 2017-11-05 15:23 howhy
阅读(471)
评论(0)
推荐(0)
python type metaclass
摘要: obj=Foo()##Foo类是MyType类的对象 所以先执行MyType的init Foo()加括号执行MyType的call foo=type('Foo',(object,),{'say':lambda a:123}) ##所有类都是type类的对象 print(foo().say()) fo
阅读全文
posted @ 2017-11-05 14:40 howhy
阅读(205)
评论(0)
推荐(0)
python 类特殊成员
摘要: 结果:
阅读全文
posted @ 2017-11-05 13:13 howhy
阅读(150)
评论(0)
推荐(0)
python 道生一,一生二,二生三,三生万物
摘要: 千万不要被所谓“元类是99%的python程序员不会用到的特性”这类的说辞吓住。因为每个中国人,都是天生的元类使用者 学懂元类,你只需要知道两句话: 道生一,一生二,二生三,三生万物 我是谁?我从哪来里?我要到哪里去? 道生一,一生二,二生三,三生万物 我是谁?我从哪来里?我要到哪里去? 在pyth
阅读全文
posted @ 2017-11-05 09:45 howhy
阅读(1454)
评论(0)
推荐(0)
2017年10月28日
scrapy
摘要: response.selector.xpath('//')#//从根开始匹配 .xpath('//img[@*])#找出所有img的所有属性 .xpath('//img/@src').extract()#找出所有img的src属性 .xpath('//a[@href='index.html']').
阅读全文
posted @ 2017-10-28 21:09 howhy
阅读(163)
评论(0)
推荐(0)
2017年10月27日
python 虚拟环境
摘要: 用pyenv 和 virtualenv 搭建单机多版本python 虚拟开发环境 作为主流开发语言, 用python 开发的程序越来越多。 方便的是大多linux系统里面都默认集成了python, 开发可以随时随地开始。 但有时候这也成为了一个短板, 比如说有时候我们需要开发和调试一些需要安装在默认
阅读全文
posted @ 2017-10-27 18:58 howhy
阅读(263)
评论(0)
推荐(0)
celery使用
摘要: linux shell启动:celery -A celery_study worker --loglevel=info linux shell#cd 到celery_study.py的目录 执行python >>from celery_study import add >>add.delay(3,4
阅读全文
posted @ 2017-10-27 13:33 howhy
阅读(255)
评论(1)
推荐(0)
2017年10月26日
redis install
摘要: yum install -y epel-release yum install -y redis vim /etc/redis.conf 修改:bind 0.0.0.0 requirepass foobared123 systemctl restart redis redis-cli >>auth
阅读全文
posted @ 2017-10-26 18:20 howhy
阅读(284)
评论(0)
推荐(0)
上一页
1
···
17
18
19
20
21
22
23
24
25
···
41
下一页
公告