Question: Write a Python function named ruin_a_webpage(). This function takes a single string argument named filename. filename will contain the name of an HTML file. Check

 Write a Python function named ruin_a_webpage(). This function takes a single

Write a Python function named ruin_a_webpage(). This function takes a single string argument named filename. filename will contain the name of an HTML file. Check the extension on the file using a regular expression. If the extension is not ".html" or ".htm", then the function should return None. Otherwise, the function should read in the HTML file and do the following: 1. Use regular expressions to find content enclosed in paragraph tags, P> and

, remove the paragraph tags, and then append 2 line break tags to the content, 2. Remove all matched pairs of open and close span tags, and 3. Write the modified HTML content to a file called, "ruined.html" For example, if the input file contains: Chtml>

ptrees of green, red roses too PIsee them bloom for me and you

(what a wonderful world)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!