lundi 31 août 2015

Pythpn Regex Select Element

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!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire