I have the following HTML:
<div id="infoTable">
    <h4>
      User
    </h4>
    <table>
        <tbody>
            <tr>
                <td class="name">
                    <a href="/userpage/123">BillyBob12345</a>
                </td>
            </tr>
            <tr>
                <td class="name">
                    <a href="/userpage/124">JimBob43</a>
                </td>
            </tr>
        </tbody>
    </table>
    <h4>
      Super User
    </h4>
    <table>
        <tbody>
            <tr>
                <td class="name">
                    <a href="/userpage/112">CookieMonster</a>
                </td>
            </tr>
        </tbody>
    </table>
</div>
Basically, I am looking to get two lists:
Users = [{"BillyBob12345" : "123"}, {"JimBob43" : "124"}]
SuperUsers = [{"CookieMonster" : "112"}]
I am currently using Python 2.7 with BeautifulSoup4 and I am able to find all of the users, but I can't split them up into their respectful groups.
 
                        
If you happen to know that they are in that order, you could just use a list comprehension to create those lists of dictionaries, parsing the "userpage" number using
.split('/'):If you want to access the name "Users" to then use it into a dictionary, you can use: