FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Engineering_Python/HTMLTableStripMod.py at master · OnScale/Engineering_Python · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
OnScale
/
Engineering_Python
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
0
Code
Issues
0
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Engineering_Python
/
HTMLTableStripMod.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
70 lines (48 loc) · 1.92 KB
Breadcrumbs
Engineering_Python
/
HTMLTableStripMod.py
Copy path
File metadata and controls
70 lines (48 loc) · 1.92 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
60
61
62
63
64
65
66
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 22 09:29:15 2014
@author: adminGH
Script to get subdirectories and filenames
"""
root
=
os
.
getcwd
()
path
=
os
.
path
.
join
(
root
,
'strip_table'
,
'testsub'
)
# create list to store file names
fname
=
[]
fold
=
[]
for
path
,
subdirs
,
files
in
os
.
walk
(
path
):
for
name
in
files
:
if
".htm"
in
name
:
# create lists of files and folders
fname
.
append
(
name
)
fold
.
append
(
path
)
# Open html files for editing
fileIN
=
open
(
os
.
path
.
join
(
path
,
name
),
"r"
)
# read in Mylines variable
html
=
fileIN
.
readlines
()
fileIN
.
close
()
# first table tag entry
ChkTop
=
"<table"
end
=
">"
# last table tag entry
ChkBot
=
"</table>"
# serach for tags and remove top <table>
for
i
in
html
:
if
ChkTop
in
i
:
top
=
i
[:
-
len
(
end
)]
html
.
remove
(
i
)
break
# reverse html to remove bottom tag
list
.
reverse
(
html
)
for
i
in
html
:
if
ChkBot
in
i
:
bot
=
i
[:
-
len
(
end
)]
html
.
remove
(
i
)
break
# reverse back to original format
list
.
reverse
(
html
)
# overwrite existing file with new list
outFile
=
'mod'
+
name
fileOUT
=
open
(
os
.
path
.
join
(
path
,
outFile
),
"w"
)
for
i
in
html
:
fileOUT
.
write
(
"%s"
%
i
)
fileOUT
.
close
()
Back
|
FazBrowse Home
|
New Git URL