I want to create an empty list in python so that I can add items into it later by a function. But when I tried to add items into it through function it showed me "TypeError: Can't convert 'tuple' object to str implicitly". Why am getting this?
page = "There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, " \
"or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't " \
"anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, " \
"making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence " \
"structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, " \
"or non-characteristic words etc."
find_word = "the"
word_positions = []
pos = 0
while page.find(find_word) != -1:
word_positions.append(page.find((find_word, pos)))
pos = pos + len(find_word)
print(word_positions)