上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 36 下一页
摘要: node是js运行环境 事件驱动型 异步非阻塞的 阅读全文
posted @ 2018-09-04 09:59 howhy 阅读(161) 评论(0) 推荐(0) 编辑
摘要: fab -u username -p password -H hostname -P -- cmd 或root@'hostname' -H多个主机是引号用逗号隔开 -P异步 阅读全文
posted @ 2018-03-19 17:37 howhy 阅读(212) 评论(0) 推荐(0) 编辑
摘要: from inspect import signature#python3才有的模块 def typeassert(*args,**kwargs): def decorator(fun): sig=signature(fun) btypes=sig.bind_partial(*args,**kwargs).arguments def wra... 阅读全文
posted @ 2018-03-19 14:12 howhy 阅读(1864) 评论(0) 推荐(0) 编辑
摘要: f=open("123.txt","w",buffering=2)#默认是按块全缓冲的可以buffer大于1 buffering=1 是按行缓冲 为0是无缓冲但与平台也有关系 f.wirte("123")# 此时只写了3个字节 tail -f 123.txt 看不到任何数据 f.write("*"* 阅读全文
posted @ 2018-03-17 11:21 howhy 阅读(193) 评论(0) 推荐(0) 编辑
摘要: str1="2017-10-15 this is happy day..." >>> re.sub("(\d{4})-(\d{2})-(\d{2})",r"\2/\3/\1",str1) ##'10/15/2017 this is happy day...' >>> re.sub("(?P\d{4})-(?P\d{2})-(?P\d{2})",r"\g/\g/\g",str1) #'10/15/... 阅读全文
posted @ 2018-03-17 09:50 howhy 阅读(123) 评论(0) 推荐(0) 编辑
摘要: from itertools import islice f=open("pyhpd.txt") for a in islice(f,2,6): print(a) 阅读全文
posted @ 2018-03-16 16:40 howhy 阅读(7201) 评论(0) 推荐(0) 编辑
摘要: 在python中,== 与 is 之间既有区别,又有联系,本文将通过实际代码的演示,力争能够帮助读到这篇文章的朋友以最短的时间理清二者的关系,并深刻理解它们在内存中的实现机制。 扯淡的话不多说,下面马上呈上我的第一张图: 通过上面代码的比较,我想很容易看得出," is" 是用来比较 a 和 b 是不 阅读全文
posted @ 2018-03-16 12:00 howhy 阅读(264) 评论(0) 推荐(0) 编辑
摘要: class Attr(object): def __init__(self,attrname,attrtype): self.attrname=attrname self.attrtype=attrtype def __get__(self,instance,value): return instance.__dict__[sel... 阅读全文
posted @ 2018-03-16 11:52 howhy 阅读(2101) 评论(0) 推荐(0) 编辑
摘要: class Player(object): def __init__(self,name,age,life): self.name=name self.age=age self.life=life class Player1(object): __slots__=("name","age","life") def __ini... 阅读全文
posted @ 2018-03-16 11:32 howhy 阅读(240) 评论(0) 推荐(0) 编辑
摘要: from functools import total_ordering from abc import ABCMeta,abstractmethod @total_ordering class Shape(object): @abstractmethod def area(self): pass def __eq__(self,obj): ... 阅读全文
posted @ 2018-03-16 11:28 howhy 阅读(922) 评论(0) 推荐(0) 编辑
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 36 下一页