0

I've got an array with elements which are different names such as and

[abc, def, agh § dsd, sdse, 12a § asd].

I would like to select only those that have § in it and erase the other elements from the array.

The names change in length and also the position of § in the name changes.

Does anybody have an idea?

Mine was

    names = [re.findall(r'(?<=>)[^><]+(?=<)', str(i).strip()) for i in select('§')]

However, my regex skills are below zero...so...help is much appreciated!

joeforker
  • 40,459
  • 37
  • 151
  • 246
RC_Data
  • 99
  • 1
  • 1
  • 8

1 Answers1

2

If the elements are strings, [name for name in names if not '§' in name]

joeforker
  • 40,459
  • 37
  • 151
  • 246