Painting Blue Code
Simple, self-explanatory code snippets.
2017-10-12
Python - Replace three consecutive dot-space strings (. . . ) with triple dot (...)
import re
str = "This is one . . . . . This is two. And other."
print re.sub( r'
((\. )
\2{2,2}
)', '...', str)
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment