Jun-29-2019, 06:54 PM
I was trying to see if this question has been answered. The first print statement shows a pesky character at the beginning of the 2nd list item. I say character because .strip() didn't work to remove it. The loop removes the character, verified in the 2nd print statement. But is there an easier way? Also, what is this character?
sentences = 'This is a sentence. This is too.' sentence_list = sentences.split('.') sentence_list.pop() print(sentence_list) for i in range(len(sentence_list)): if i > 0: sentence_list[i] = sentence_list[i][1:] print(sentence_list)