摘要: 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) 编辑