Created
April 27, 2020 22:46
-
-
Save thisismattmiller/660ddd9cfe4ad6e5c75efe540642c4b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| from bs4 import BeautifulSoup | |
| html = '<h2 class="learn-to-grow-heading"> Learn to Grow French Breakfast Radish </h2><div class="row"><div class="col-md-3 col-xs-6 item-details-growing-instruction-tile"><noscript><img src="/site/img/sca/Icons/Direct-Seed.jpg"></noscript><p>Direct Seed: 1" Apart</p></div><div class="col-md-3 col-xs-6 item-details-growing-instruction-tile"><noscript><img src="/site/img/sca/Icons/Planting-Depth.jpg"></noscript><p>Seed Depth: 1/2"</p></div><div class="clearfix visible-sm-block"></div><div class="col-md-3 col-xs-6 item-details-growing-instruction-tile"><noscript><img src="/site/img/sca/Icons/Spacing-between-Rows.jpg"></noscript><p>Rows Apart: 12"</p></div><div class="col-md-3 col-xs-6 item-details-growing-instruction-tile"><noscript><img src="/site/img/sca/Icons/Thinning.jpg"></noscript><p>Thin: 2-3" Apart</p></div></div><div class="row"><div class="col-xs-12"><div class="learn-to-grow-extra-details"><p><font color="#007496"><b>Instructions</b></font> - Sow seeds outdoors as soon as soil can be worked in spring. Plant in full sun. Successive plantings can be made every 3-4 weeks throughout summer and fall to provide a continual harvest.</p>' | |
| soup = BeautifulSoup(html, "html.parser") | |
| seed_apart = soup.find("p", text=re.compile("Direct Seed:")) | |
| print(seed_apart.text) | |
| seed_depth = soup.find("p", text=re.compile("Seed Depth:")) | |
| print(seed_depth.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment