import re
lista = ['banana [amarela]\n', 'uva [vinho]\n', 'laranja [laranjado]\n', 'kiwi [verde]\n', 'framboesa [vermelho]\n', 'coco [marrom]\n']
pattern = re.compile(r"(.+) \[(.+)\]\n?")
frutas = []
cores = []
for item in lista:
if pattern.match(item):
fruta, cor = pattern.search(item).groups()
frutas.append(fruta)
cores.append(cor)
print(frutas)
print(cores)
aW1wb3J0IHJlCgpsaXN0YSA9IFsnYmFuYW5hIFthbWFyZWxhXVxuJywgJ3V2YSBbdmluaG9dXG4nLCAnbGFyYW5qYSBbbGFyYW5qYWRvXVxuJywgJ2tpd2kgW3ZlcmRlXVxuJywgJ2ZyYW1ib2VzYSBbdmVybWVsaG9dXG4nLCAnY29jbyBbbWFycm9tXVxuJ10KCnBhdHRlcm4gPSByZS5jb21waWxlKHIiKC4rKSBcWyguKylcXVxuPyIpCgpmcnV0YXMgPSBbXQpjb3JlcyA9IFtdCgpmb3IgaXRlbSBpbiBsaXN0YToKICAgIGlmIHBhdHRlcm4ubWF0Y2goaXRlbSk6CiAgICAgICAgZnJ1dGEsIGNvciA9IHBhdHRlcm4uc2VhcmNoKGl0ZW0pLmdyb3VwcygpCiAgICAgICAgZnJ1dGFzLmFwcGVuZChmcnV0YSkKICAgICAgICBjb3Jlcy5hcHBlbmQoY29yKQogICAgICAgIApwcmludChmcnV0YXMpCnByaW50KGNvcmVzKQ==
['banana', 'uva', 'laranja', 'kiwi', 'framboesa', 'coco']
['amarela', 'vinho', 'laranjado', 'verde', 'vermelho', 'marrom']