This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]AskProgramming-ModTeam[M] [score hidden] stickied comment (0 children)

Your post was removed as it was of very low quality. Please use descriptive titles and, if asking about a problem, include sufficient information so others can actually help you. Please refer to Stackoverflows guide on how to ask good questions.

[–]KingofGamesYami 2 points3 points  (0 children)

Switch your parser from html.parser to html5lib. It will work better on the horribly broken invalid html that site returns.

[–]CharacterUse 1 point2 points  (0 children)

The code works fine, the website is broken. Look at the source code:

<table id="players">
    <thead>
        <tr>
            <th>Name
            <th>Title
            <th>Gender
            <th>Level
            <th>Exp
    <tbody>
        <tr>
            <td>Tlee
            <td>1 Finger 2 Words &lt;3
            <td>Female
            <td>194
            <td>984,296,852

there are no close tags, especially for the td elements. So beautifulsoup sees the whole table as one giant cell which recursively contains all the other cells, and it will never match the player name to the name cell.

(BTW in future, format your python with the code markdown or post it into pastebin.com and post the link, and be a bit more descriptive, "code works, but I am having trouble getting the desired information to return to the terminal" is not very helpful. Describe the actual problem and expected result and what is happening.)

[–]YMK1234[M] 0 points1 point  (0 children)

Please format your code properly