How to pull div attributes with BeautifulSoup in Python
<p>I'm trying to pull this data (lat and lng):</p>

<pre><code>&lt;div class="location"
    lat="1234"
    lng="5678"
&gt;
</code></pre>

<p>This is giving me nothing:</p>

<pre><code>print (soup.find_all("div", { "class" : "location"}))
</code></pre>

<p>My eventual goal is to store these values in a dictionary. Thanks.</p>

<p>You can use the <em>dictionary like-access to element attribute</em> in BeautifulSoup:</p>

<pre><code>locations = [{'lat': location['lat'], 'lng': location['lng']}
             for location in soup.find_all("div", {"class": "location"})]
</code></pre>

<p>If there is a single location, use <code>find()</code> instead:</p>

<pre><code>location = soup.find("div", {"class": "location"})
print({'lat': location['lat'], 'lng': location['lng']})
</code></pre>

<blockquote>
  <p>This is giving me nothing</p>
</blockquote>

<p>This is though a separate problem. You might just not have this element in the parsed HTML.</p>

python beautifulsoup