上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 37 下一页
摘要: PS D:\python\py_test> python3 .\t1.py 手动触发exceptionerror: 出错了 print(123) assert 1==1##若成立则执行后面的代码 反之直接报错 print(456) 阅读全文
posted @ 2017-11-05 15:23 howhy 阅读(464) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 结果: 阅读全文
posted @ 2017-11-05 13:13 howhy 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 千万不要被所谓“元类是99%的python程序员不会用到的特性”这类的说辞吓住。因为每个中国人,都是天生的元类使用者 学懂元类,你只需要知道两句话: 道生一,一生二,二生三,三生万物 我是谁?我从哪来里?我要到哪里去? 道生一,一生二,二生三,三生万物 我是谁?我从哪来里?我要到哪里去? 在pyth 阅读全文
posted @ 2017-11-05 09:45 howhy 阅读(1409) 评论(0) 推荐(0) 编辑
摘要: response.selector.xpath('//')#//从根开始匹配 .xpath('//img[@*])#找出所有img的所有属性 .xpath('//img/@src').extract()#找出所有img的src属性 .xpath('//a[@href='index.html']'). 阅读全文
posted @ 2017-10-28 21:09 howhy 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 用pyenv 和 virtualenv 搭建单机多版本python 虚拟开发环境 作为主流开发语言, 用python 开发的程序越来越多。 方便的是大多linux系统里面都默认集成了python, 开发可以随时随地开始。 但有时候这也成为了一个短板, 比如说有时候我们需要开发和调试一些需要安装在默认 阅读全文
posted @ 2017-10-27 18:58 howhy 阅读(245) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(246) 评论(1) 推荐(0) 编辑
摘要: 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 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 操作: 后台shell命令: 执行mongo进入 help查看帮助命令 use test数据库 然后插入一条数据 数据库test才会创建 db.help;查看db命令 db.createUser({user:'dba',pwd:'123456',roles: [ { role: "userAdmin 阅读全文
posted @ 2017-10-26 09:50 howhy 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 不可变类型是可hash #tuple str freezeset 可变类型是不可hash ##list set 阅读全文
posted @ 2017-10-25 22:51 howhy 阅读(2177) 评论(0) 推荐(0) 编辑
上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 37 下一页