Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #68045

Re: How to extract contents of inner text of html tag?

References <1393697458.5147.YahooMailNeo@web126004.mail.ne1.yahoo.com>
Date 2014-03-08 09:55 -0700
Subject Re: How to extract contents of inner text of html tag?
From Jason Friedman <jsf80238@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.7933.1394297744.18130.python-list@python.org> (permalink)

Show all headers | View raw


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

I modified your code slightly:
for line in all_kbd:
    print(line)
    sys.exit()
    if line.string == None:

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

Meaning that
all_kbd=soup.find_all('kbd')

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 your_program.py

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: How to extract contents of inner text of html tag? Jason Friedman <jsf80238@gmail.com> - 2014-03-08 09:55 -0700

csiph-web