-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript
More file actions
executable file
·59 lines (52 loc) · 1.11 KB
/
script
File metadata and controls
executable file
·59 lines (52 loc) · 1.11 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/python
import sys, re, os
program='HTML to CSV'
inputfile=sys.argv[1]
outputfilename='outputs/csv/'+os.path.splitext(inputfile)[0]+'.csv'
fl=open(inputfile, "r")
fw=open(outputfilename,"w+")
k=[]
kk=[]
kkk=[]
kkkk=[]
kkkkk=[]
kkkkkk=[]
kkkkkkk=[]
kkkkkkkk=[]
kkkkkkkkk=[]
kkkkkkkkkk=[]
for line in fl:
if line[0:4] == "<TR>":
k.append(line)
fl.close()
for i in k:
j=re.sub(r'<TR><TD>','',i)
kk.append(j)
for c in kk:
cl=re.sub(r'</TD><TD>',',',c)
kkk.append(cl)
for d in kkk:
cr=re.sub(r'</TD></TR>\r\n',',',d)
kkkk.append(cr)
for e in kkkk:
ca=re.sub(r'<A HREF="#','',e)
kkkkk.append(ca)
for f in kkkkk:
cg=re.sub(r'>','',f)
kkkkkk.append(cg)
for g in kkkkkk:
ct=re.sub(r'</TD,<TD class=','',g)
kkkkkkk.append(ct)
for h in kkkkkkk:
cab=re.sub(r'</A','',h)
kkkkkkkk.append(cab)
for m in kkkkkkkk:
cam=re.sub(r'</TD<TD class="',',',m)
kkkkkkkkk.append(cam)
for n in kkkkkkkkk:
caq=re.sub(r'"',',',n)
kkkkkkkkkk.append(caq)
print 'Converting %s to %s...' % (inputfile, outputfilename)
for w in kkkkkkkkkk :
if w[0:4] != "<TR<":
fw.write('\r'+w+'\r')