正则表达式

正则表达式学习链接

http://deerchao.net/tutorials/regex/regex.htm#greedyandlazy

1、删除任意空白字符(换行符,空字符等)

>>> a="		
 123"
>>> a
'		
 123'
>>> b = re.sub(r's+','', a) #s   匹配任意的空白符
>>> b
'123'

  

kingrain送给读者的话:Everthing isn't getting along well,your efforts paid off!
原文地址:https://www.cnblogs.com/iamjqy/p/6704254.html