python remove 5ct

Solutions on MaxInterview for python remove 5ct by the best coders in the world

showing results for - "python remove 5ct"
Gaëlle
23 Jul 2018
1>>> s="abc \n \t \t\t \t \nefg"
2>>> ''.join(s.split())
3'abcefg'
4>>> ''.join(c for c in s if not c.isspace())
5'abcefg'
6
7import re
8
9s = 'abc \n \t \t\t \t \nefg'
10re.sub(r'\s', '', s)
11=> 'abcefg'