replaced strip with regex replace

Signed-off-by: klux2 <k.lux.gm@gmail.com>
This commit is contained in:
klux2 2019-10-01 00:19:30 +02:00
parent 5a565237e6
commit 3b5044e536

View file

@ -9,6 +9,7 @@ import traceback
import urllib.request import urllib.request
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from enum import Enum from enum import Enum
from re import sub
from time import time from time import time
from typing import Any from typing import Any
from urllib.error import HTTPError from urllib.error import HTTPError
@ -297,7 +298,7 @@ async def get_essen(only_today: bool) -> None:
for i in menus: for i in menus:
kategorie = i.findall("type")[0].text kategorie = i.findall("type")[0].text
essen_transl.append(kategorie) essen_transl.append(kategorie)
name = i.findall("description")[0].text.rstrip("()1234567890, ") name = sub("\\s*\\([0-9A-Z, ]*\\)", "", i.findall("description")[0].text)
essen_transl.append(name) essen_transl.append(name)
try: try:
preis = float(i.findall("./prices/price[label='Studenten']/value")[0].text.replace(",", ".")) preis = float(i.findall("./prices/price[label='Studenten']/value")[0].text.replace(",", "."))