from bs4 import BeautifulSoup def process_html_file(file_path): with open(file_path, 'r', encoding='utf-8') as file: soup = BeautifulSoup(file, 'html.parser') for a_tag in soup.find_all('a', href=True): print("Current page: {}".format(a_tag['href'])) choice = input("Do you want to delete (d) or rename (r) this page, or keep it as is (enter)? ").lower() if choice == 'd': a_tag.decompose() elif choice == 'r': new_name = input("Enter the new name for this page: ") a_tag['href'] = new_name with open(file_path, 'w', encoding='utf-8') as file: file.write(str(soup)) print("Index file updated.") # Path to the index.html file html_file = 'index.html' process_html_file(html_file)