May-05-2020, 10:16 PM
Hi
The children of a node of the xml file I'm using all contain two ancient greek words as attributes, named «data-alpha» and «data-omega». Given an other greek word, I want to find out the node of which «data-omega» is alphabetically before this other word and of which next sibling's «data-alpha» is alphabetically after this word.
I've made it to search nodes based on attributes with regular expression, such as
Arbiel
The children of a node of the xml file I'm using all contain two ancient greek words as attributes, named «data-alpha» and «data-omega». Given an other greek word, I want to find out the node of which «data-omega» is alphabetically before this other word and of which next sibling's «data-alpha» is alphabetically after this word.
I've made it to search nodes based on attributes with regular expression, such as
def ltg1(classe):
return classe is not None and classe=='js-char-popup-item symbols-grid__item u0000 '
def ltg2(classe):
return classe is not None and re.compile('js-char-popup-item symbols-grid__item').search(classe) and not re.compile('^.*disabled$').search(classe)
def les_lettres(doc_html, choix):
if choix=="ltg1":
lst=doc_html.find_all(class_=ltg1)
elif choix=='ltg2':
lst=doc_html.find_all(class_=ltg2)
for lt in lst:
dt=eval('dict('+lt.attrs['data-template']+')')
lettre, symbol, unicode = dt['title'],dt[ 'symbol'],dt[ 'number']
print(lettre, symbol, unicode)How can I do that ?Arbiel
using Ubuntu 22.04.5 LTS, Python 3.10.12
having substituted «https://www.lilo.org/fr/» to google, «https://protonmail.com/» to any other unsafe mail service and bépo to azerty (french keyboard layouts)
having substituted «https://www.lilo.org/fr/» to google, «https://protonmail.com/» to any other unsafe mail service and bépo to azerty (french keyboard layouts)
