Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #68045 > unrolled thread
| Started by | Jason Friedman <jsf80238@gmail.com> |
|---|---|
| First post | 2014-03-08 09:55 -0700 |
| Last post | 2014-03-08 09:55 -0700 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: How to extract contents of inner text of html tag? Jason Friedman <jsf80238@gmail.com> - 2014-03-08 09:55 -0700
| From | Jason Friedman <jsf80238@gmail.com> |
|---|---|
| Date | 2014-03-08 09:55 -0700 |
| Subject | Re: How to extract contents of inner text of html tag? |
| Message-ID | <mailman.7933.1394297744.18130.python-list@python.org> |
> 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 top | Article view | comp.lang.python
csiph-web