alexanderholt
10/10/2017 - 1:14 PM

Removing characters from strings

Removing using .split() .lstrip .rstrip()

test_strip = 'Braund, Mr. Owen Harris'
test_strip.split('.')[1].lstrip()
# . split splits string into two tuples on either side of string
# then I pull the second tuple
#.lstrip removes leading white space by default


bad[i].split('(')[1].lstrip().rstrip(')')