I am trying to extract a part of a string and append it to a list (message). But at the end, what I see is just one item appended (the last one) to the list. Below is my code. What am i doing wrong?
for item in all_text:
message = []
if len(item) < 2:
continue
else:
m_temp = item.split(']')[1].split(':')
if len(m_temp) <= 1:
continue
else:
message.append(m_temp[1])
print(len(message))
print(message)