-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscratchpad.py
More file actions
executable file
·40 lines (36 loc) · 939 Bytes
/
Copy pathscratchpad.py
File metadata and controls
executable file
·40 lines (36 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python3
import re
from sys import path
import os
path.append(os.getcwd()+"/..")
from util import fetch
from mensa.parser import parse
#def parse(string):
# string = re.sub(r"\r|\n","",string)
# string = re.sub(r" "," ",string)
# tbl_rgx = re.compile(r"<table.*?><tbody>(.*?)</tbody>.*?</table>")
# tbl_match = tbl_rgx.search(string)
# tbl = tbl_match.group(1)
# rows = []
# for line in re.split(r"<tr>|</tr>",tbl):
# if line:
# row = []
# for cell in re.split(r"<td>|</td>",line):
# if cell:
# row.append(cell)
# rows.append(row)
# return rows
def main():
#res = parse(fetch())
with open("speiseplan_beispiel.html","rb") as data:
#html = str(data.read(),encoding="latin_1",errors="ignore")
html = data.read()
themenu = parse(html)
for date in themenu.dates():
for dish in themenu[date]:
print(dish)
#return(res)
#for row in res:
# print(row)
if __name__ == "__main__":
main()