I was trying to extract the state name from the string 'Rhode Island[edit]'
.
When I tried .split('[[]').str[0]
, I was given the correct result 'Rhode Island'.
However, when I tried .rstrip('[edit]')
, I was given the wrong result 'Rhode Islan'.
I got confused why the character 'd' before the left bracket was also removed when I used rstrip function.