title: Find the corresponding siblings in meta content using Beautiful Soup
body: <p>The original html looks like:</p>
  <pre><code>  &lt;meta content=&quot;A&quot; name=&quot;citation_author&quot;/&gt;
    &lt;meta content=&quot;Axxxxx&quot; name=&quot;citation_author_institution&quot;/&gt;
    &lt;meta content=&quot;Aorcid&quot; name=&quot;citation_author_orcid&quot;/&gt;
    &lt;meta content=&quot;B&quot; name=&quot;citation_author&quot;/&gt;
    &lt;meta content=&quot;Bxxx1&quot; name=&quot;citation_author_institution&quot;/&gt;
    &lt;meta content=&quot;Bxxx2&quot; name=&quot;citation_author_institution&quot;/&gt;
    &lt;meta content=&quot;C&quot; name=&quot;citation_author&quot;/&gt;
    &lt;meta content=&quot;D&quot; name=&quot;citation_author&quot;/&gt;
    &lt;meta content=&quot;Dorcid&quot; name=&quot;citation_author_orcid&quot;&gt;
    &lt;meta content=&quot;E&quot; name=&quot;citation_author&quot;/&gt;
    &lt;meta content=&quot;Eyyyyy&quot; name=&quot;citation_email&quot;/&gt;
  </code></pre>
  <p>The output results should be like this：</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>name</th>
  <th>instituion</th>
  <th>orcid</th>
  <th>email</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>A</td>
  <td>Axxxxx</td>
  <td>Aorcid</td>
  <td></td>
  </tr>
  <tr>
  <td>B</td>
  <td>Bxxx1; Bxxx2</td>
  <td></td>
  <td></td>
  </tr>
  <tr>
  <td>C</td>
  <td></td>
  <td></td>
  <td></td>
  </tr>
  <tr>
  <td>D</td>
  <td></td>
  <td>Dorcid</td>
  <td></td>
  </tr>
  <tr>
  <td>E</td>
  <td></td>
  <td></td>
  <td>Eyyyyy</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I'm using Python 3.7.</p>
  <p>I tried using 'find_all' to get all the names, then using find_next_sibling('meta', 'name':'xxx') to get the corresponding columns of a specific author. But just the take the example of ORCID, since authors BC dont have ORCID, the codes I wrote will return the ORCID of D.</p>
  <pre><code>AU_names = soup.find_all('meta', {'name': 'citation_author'})
  for name in AU_names:
      AU_name = name.attrs['content']
      ORCID = name.find_next_sibling('meta', {'name': 'citation_author_orcid'})
      ORCID = ORCID.attrs['content'] if ORCID else ''
      print(AU_name, ORCID)
  </code></pre>
  <p>Could anyone help me? Thank u!</p>