摘要: #regex replace character in string re.sub(r"[():;,]"," ",line) #check whether a string is an existed file if os.path.isfile(fldPnNanmeValueFile) is not True: continue # print with paramters prin... 阅读全文
posted @ 2016-01-07 16:21 鱼悠游 阅读(187) 评论(0) 推荐(0) 编辑
摘要: #1. keep strings in double quote as one word when split string to words #e.g. str = ‘a b "is si" d ’ #to #['a','b','is si','d'] #use shlex module import shlex words = shlex.split(line) #2. join s... 阅读全文
posted @ 2016-01-07 16:01 鱼悠游 阅读(310) 评论(0) 推荐(0) 编辑
摘要: assuming words only contain a-zA-Z0-9.search: (\)replace: "\1" 阅读全文
posted @ 2016-01-07 15:50 鱼悠游 阅读(113) 评论(0) 推荐(0) 编辑