How to extract contents of inner text of html tag?

Jason Friedman jsf80238 at
Sat Mar 8 17:55:35 CET 2014

> for line in all_kbd:
>    if line.string == None:

I modified your code slightly:
for line in all_kbd:
    if line.string == None:

Running the new script yields:
$ python
<kbd class="command">
    cp -v --remove-destination /usr/share/zoneinfo/
    <em class="replaceable"><code><xxx></xxx></code></em>

Meaning that

yields only a single string, not multiple strings as I'm guessing you expected.

You might also consider running your program as:

python -m pdb

More information about the Python-list mailing list