You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
887 B
Python
50 lines
887 B
Python
5 years ago
|
# from termcolor import colored
|
||
|
|
||
|
# read_file = 'this', 'Services', 'are', 'wrong', 'Services'
|
||
|
# l1 = ['Services']
|
||
|
# formattedText = []
|
||
|
|
||
|
# for same_word in read_file:
|
||
|
# if same_word in l1:
|
||
|
# formattedText.append(colored(same_word,'white','on_red'))
|
||
|
# else:
|
||
|
# formattedText.append(same_word)
|
||
|
|
||
|
# print(" ".join(formattedText))
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
from termcolor import colored
|
||
|
from bs4 import BeautifulSoup
|
||
|
|
||
|
|
||
5 years ago
|
with open('tag_comparison.html', 'r') as tag_comp_file:
|
||
|
tag_content = tag_comp_file.read()
|
||
|
|
||
5 years ago
|
|
||
|
#automation?
|
||
|
#find a same class
|
||
5 years ago
|
html = BeautifulSoup(tag_content, 'html.parser')
|
||
5 years ago
|
my_divs = html.find_all('span', {'class': 'NN'})
|
||
|
|
||
|
print(my_divs)
|
||
|
|
||
|
|
||
|
for span in my_divs:
|
||
|
html.new_tag('css')
|
||
|
|
||
|
add_group_color = html.new_tag('div')
|
||
|
add_group_color['class'] = 'add_group_color'
|
||
|
add_group_color['style'] = 'border-bottom: 2px solid red);'
|
||
|
my_divs.append(add_group_color)
|
||
|
|
||
|
print(add_group_color)
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|