rei
0
Q:

python remove \t

# the list.remove(object) method takes one argument 
# the object or element value you want to remove from the list
# it removes the first coccurence from the list

generic_list = [1, 2, 2, 2, 3, 3, 4, 5, 5, 5, 6, 8, 8, 8]

generic_list.remove(1)

# The Generic list will now be:
# [2, 2, 2, 3, 3, 4, 5, 5, 5, 6, 8, 8, 8]

5
>>> s="abc \n \t \t\t \t \nefg"
>>> ''.join(s.split())
'abcefg'
>>> ''.join(c for c in s if not c.isspace())
'abcefg'

import re

s = 'abc \n \t \t\t \t \nefg'
re.sub(r'\s', '', s)
=> 'abcefg'
0

New to Communities?

Join the community