常用形容词副词的比较级和最高级
with open(r'd:/常用形容词副词的比较级和最高级.txt','w') as f: INTERVAL = 30 import re p = re.compile(r'(.*)(?<=\.\s)(.*?)(?=\s{2,})(\s*)(.*?)(?=\s{2,})(\s*)(.*)',re.IGNORECASE) #f.write(''.join([g[1]+' '*(INTERVAL-len(g[1]))+g[3]+' '*(INTERVAL-len(g[3]))+g[5]+'\n' for g in [m.groups() for m in [re.match(p,line_new) for line_new in [re.sub(r'\t',' ',line).strip() for line in open(r'd:/old.txt')]] if m]])) #可以用上面一句搞定下面几句,但看起来会很费劲 for line in open(r'd:/old.txt'): line_new = re.sub(r'\t',' ',line).strip() m = re.match(p,line_new) if m: g = m.groups() #print(g) #f.write(g[0]+g[1]+' '*(INTERVAL-len(g[1])-len(g[0]))+g[3]+' '*(INTERVAL-len(g[3]))+g[5]+'\n') f.write(g[1]+' '*(INTERVAL-len(g[1]))+g[3]+' '*(INTERVAL-len(g[3]))+g[5]+'\n')?
?
来源:
常用形容词副词的比较级和最高级 A - F??? http://blog.sina.com.cn/s/blog_454bb7130100ctm2.html
常用形容词副词的比较级和最高级 G - N?? http://blog.sina.com.cn/s/blog_454bb7130100cqyl.html
常用形容词副词的比较级和最高级 O - S?? http://blog.sina.com.cn/s/blog_454bb7130100cv2m.html
常用形容词副词的比较级和最高级 T - Z?? http://blog.sina.com.cn/s/blog_454bb7130100cyq2.html