Skip to content
0:00 / 0:00

#debugging#python#htmlparsing

Fixing the Bug Solution - Software Debugging

Udacity

655K subscribers • 8 videos on Hallway

YouTube
  • Recommended by 1 person: 1 on Stack Overflow and its sister sites.

Beginner. No background in the topic needed.

2K views11 years ago1 recommendation

Tools and practiceProgramming languagesDebuggingPython

Shows the solution to fixing the HTML markup removal bug in Python.

This video is part of an online course, Software Debugging. Check out the course here: udacity.com/course/cs259.

Why it's here

1 person recommends this

What people say. Recommended as a step-by-step solution to fixing a basic HTML parsing bug in Python.

Moments people linked to

Igor Medeiroson Stack Overflow • Recommends

On “Strip HTML from strings in Python”

There's a simple way to this: def remove_html_markup(s): tag = False quote = False out = "" for c in s: if c == '<' and not quote: tag = True elif c == '>' and not quote: tag = False elif (c == '"' or c == "'") and tag: quote = not quote elif not tag: out = out + c return out The idea is explained here: link to this video You can see it working here: link to this video PS - If you're interested in the class(about smart debugging with python) I give you a link: http://www.udacity.com/overview/Course/cs259/CourseRev/1. It's free! You're welcome! :)
26View the answer

Igor Medeiroson Stack Overflow • Recommends

On “Python code to remove HTML tags from a string”

There's a simple way to this in any C-like language. The style is not Pythonic but works with pure Python: def remove_html_markup(s): tag = False quote = False out = "" for c in s: if c == '<' and not quote: tag = True elif c == '>' and not quote: tag = False elif (c == '"' or c == "'") and tag: quote = not quote elif not tag: out = out + c return out The idea based in a simple finite-state machine and is detailed explained here: link to this video You can see it working here: link to this video PS - If you're interested in the class(about smart debugging with python) I give you a link: https://www.udacity.com/course/software-debugging--cs259. It's free!
9View the answer