I have a list of strings(colors), say
l = ['chocolate brown','brown','chocolate']
I have a string:
str = "The jeans is chocolate brown in color and has brown colored pockets"
I have to remove chocolate brown and brown from the list. This is just an example. Basically whenever I encounter a color in a string I have to remove it if it exists in the list of colors. What is the efficient way to do it?
Aucun commentaire:
Enregistrer un commentaire