Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'I am good boy'
- 'I am good boy'
- ' '.join(i for i in 'I am good boy'.split(' ') if i != '')
- In [1]: s = 'I am good boy'
- In [2]: import re
- In [3]: re.sub(r's{2,}', ' ', s)
- Out[3]: 'I am good boy'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement