-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathparsehtml.py
More file actions
29 lines (25 loc) · 724 Bytes
/
Copy pathparsehtml.py
File metadata and controls
29 lines (25 loc) · 724 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
def parseHTMLDeck(deck):
output = ''
saving = True
numbers = False
for i in deck:
if i=='<':
saving = False
if saving:
if i in [str(j) for j in range(10) ]:
if numbers==False:
output+='\n'
numbers = True
else:
if numbers:
numbers = False
output+=str(i)
if i=='>':
saving = True
return output
for k in range(1,778):
with open('./decks/deck_table'+str(k)+'.html','r') as f:
contents = f.read()
newContents = parseHTMLDeck(contents)
with open('formatted_deck_'+str(k),'w') as op:
op.write(newContents)