I have a text file in the following format:
this is some text __label__a
this is another line __label__a __label__b
this is third line __label__x
this is fourth line __label__a __label__x __label__z
and another list of labels
list_labels = ['__label__x','__label__y','__label__z']
Each line could contain multiple labels from the list. what is the best way to replace labels from the list in each line with "__label__no"
example:
this is third line __label__no
this is fourth line __label__a __label__no
There are a lot more lines in the text file and labels and I was wondering what is the fastest way to achieve this.