# 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 # file = open('tag_comparison.html', 'r') file = '''
1 . Eligibility You must be at least 13 years of age to access or use our Services . If you are under 18 years of age ( or the age of legal majority where you live ) , you may only access or use our Services under the supervision of a parent or legal guardian who agrees to be bound by this Agreement . If you are a parent or legal guardian of a user under the age of 18 ( or the age of legal majority ) , you agree to be fully responsible for the acts or omissions of such user in connection with our Services . If you are accessing or using our Services on behalf of another person or entity , you represent that you are authorized
''' #automation? #find a same class html = BeautifulSoup(file, 'html.parser') 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)