read content from file

master
Castro0o 5 years ago
parent e5a3d98d19
commit b3df906620

@ -21,146 +21,13 @@ from termcolor import colored
from bs4 import BeautifulSoup
# file = open('tag_comparison.html', 'r')
file = '''<div class ="paragraph">
<span class="CD">1</span>
<span class=".">.</span>
<span class="NN">Eligibility</span>
<span class="PRP">You</span>
<span class="MD">must</span>
<span class="VB">be</span>
<span class="IN">at</span>
<span class="JJS">least</span>
<span class="CD">13</span>
<span class="NNS">years</span>
<span class="IN">of</span>
<span class="NN">age</span>
<span class="TO">to</span>
<span class="NN">access</span>
<span class="CC">or</span>
<span class="VB">use</span>
<span class="PRP$">our</span>
<span class="NNS">Services</span>
<span class=".">.</span>
<span class="IN">If</span>
<span class="PRP">you</span>
<span class="VBP">are</span>
<span class="IN">under</span>
<span class="CD">18</span>
<span class="NNS">years</span>
<span class="IN">of</span>
<span class="NN">age</span>
<span class="(">(</span>
<span class="CC">or</span>
<span class="DT">the</span>
<span class="NN">age</span>
<span class="IN">of</span>
<span class="JJ">legal</span>
<span class="NN">majority</span>
<span class="WRB">where</span>
<span class="PRP">you</span>
<span class="VBP">live</span>
<span class=")">)</span>
<span class=",">,</span>
<span class="PRP">you</span>
<span class="MD">may</span>
<span class="RB">only</span>
<span class="NN">access</span>
<span class="CC">or</span>
<span class="VB">use</span>
<span class="PRP$">our</span>
<span class="NNS">Services</span>
<span class="IN">under</span>
<span class="DT">the</span>
<span class="NN">supervision</span>
<span class="IN">of</span>
<span class="DT">a</span>
<span class="NN">parent</span>
<span class="CC">or</span>
<span class="JJ">legal</span>
<span class="NN">guardian</span>
<span class="WP">who</span>
<span class="VBZ">agrees</span>
<span class="TO">to</span>
<span class="VB">be</span>
<span class="VBN">bound</span>
<span class="IN">by</span>
<span class="DT">this</span>
<span class="NNP">Agreement</span>
<span class=".">.</span>
<span class="IN">If</span>
<span class="PRP">you</span>
<span class="VBP">are</span>
<span class="DT">a</span>
<span class="NN">parent</span>
<span class="CC">or</span>
<span class="JJ">legal</span>
<span class="NN">guardian</span>
<span class="IN">of</span>
<span class="DT">a</span>
<span class="NN">user</span>
<span class="IN">under</span>
<span class="DT">the</span>
<span class="NN">age</span>
<span class="IN">of</span>
<span class="CD">18</span>
<span class="(">(</span>
<span class="CC">or</span>
<span class="DT">the</span>
<span class="NN">age</span>
<span class="IN">of</span>
<span class="JJ">legal</span>
<span class="NN">majority</span>
<span class=")">)</span>
<span class=",">,</span>
<span class="PRP">you</span>
<span class="VBP">agree</span>
<span class="TO">to</span>
<span class="VB">be</span>
<span class="RB">fully</span>
<span class="JJ">responsible</span>
<span class="IN">for</span>
<span class="DT">the</span>
<span class="NNS">acts</span>
<span class="CC">or</span>
<span class="NNS">omissions</span>
<span class="IN">of</span>
<span class="JJ">such</span>
<span class="NN">user</span>
<span class="IN">in</span>
<span class="NN">connection</span>
<span class="IN">with</span>
<span class="PRP$">our</span>
<span class="NNS">Services</span>
<span class=".">.</span>
<span class="IN">If</span>
<span class="PRP">you</span>
<span class="VBP">are</span>
<span class="VBG">accessing</span>
<span class="CC">or</span>
<span class="VBG">using</span>
<span class="PRP$">our</span>
<span class="NNS">Services</span>
<span class="IN">on</span>
<span class="NN">behalf</span>
<span class="IN">of</span>
<span class="DT">another</span>
<span class="NN">person</span>
<span class="CC">or</span>
<span class="NN">entity</span>
<span class=",">,</span>
<span class="PRP">you</span>
<span class="VBP">represent</span>
<span class="IN">that</span>
<span class="PRP">you</span>
<span class="VBP">are</span>
<span class="VBN">authorized</span></div>
'''
with open('tag_comparison.html', 'r') as tag_comp_file:
tag_content = tag_comp_file.read()
#automation?
#find a same class
html = BeautifulSoup(file, 'html.parser')
html = BeautifulSoup(tag_content, 'html.parser')
my_divs = html.find_all('span', {'class': 'NN'})
print(my_divs)

Loading…
Cancel
Save