How to get value from piece of html code with BeautifulSoup? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30 pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!What are valid values for the id attribute in HTML?How to get the current time in PythonHow do I sort a dictionary by value?How do I get the number of elements in a list in Python?How to create an HTML button that acts like a link?How can I set the default value for an HTML <select> element?How to access environment variable values?Redirect from an HTML pageHow do I reformat HTML code using Sublime Text 2?Cannot display HTML string

How can I wire a 9-position switch so that each position turns on one more LED than the one before?

What were wait-states, and why was it only an issue for PCs?

What was Apollo 13's "Little Jolt" after MECO?

What's parked in Mil Moscow helicopter plant?

/bin/ls sorts differently than just ls

Does using the Inspiration rules for character defects encourage My Guy Syndrome?

Why did Israel vote against lifting the American embargo on Cuba?

Are these square matrices always diagonalisable?

Preserving file and folder permissions with rsync

How to keep bees out of canned beverages?

Was there ever a LEGO store in Miami International Airport?

Simulate round-robin tournament draw

Determinant of a matrix with 2 equal rows

Where to find documentation for `whois` command options?

Why aren't road bicycle wheels tiny?

What is ls Largest Number Formed by only moving two sticks in 508?

Putting Ant-Man on house arrest

Why do people think Winterfell crypts is the safest place for women, children & old people?

What is the evidence that custom checks in Northern Ireland are going to result in violence?

false 'Security alert' from Google - every login generates mails from 'no-reply@accounts.google.com'

Raising a bilingual kid. When should we introduce the majority language?

`FindRoot [ ]`::jsing: Encountered a singular Jacobian at a point...WHY

How to compute a Jacobian using polar coordinates?

What is a 'Key' in computer science?



How to get value from piece of html code with BeautifulSoup?



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30 pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!What are valid values for the id attribute in HTML?How to get the current time in PythonHow do I sort a dictionary by value?How do I get the number of elements in a list in Python?How to create an HTML button that acts like a link?How can I set the default value for an HTML <select> element?How to access environment variable values?Redirect from an HTML pageHow do I reformat HTML code using Sublime Text 2?Cannot display HTML string



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








2















I just started using python for some web page scraping and BeautifulSoup seems to be recommended everywhere.



I have the content like below:



<table class="table with-row-highlight table-archive">
<tbody>
<tr>
<td>
<div class="user-tagline ">
<span class="username " data-avatar="aaaaaaa">player1</span>
<span class="user-rating">(1357)</span>
<span class="country-flag-small flag-113" tip="Portugal"></span>
</div>
<div class="user-tagline ">
<span class="username " data-avatar="bbbbbbb">player2</span>
<span class="user-rating">(1387)</span>
<span class="country-flag-small flag-70" tip="Indonesia"></span>
</div>
</td>
<td>
<a class="clickable-link text-middle" href="https://www.chess.com/live/game/2249663029?username=belemnarmada" target="_self">
<div class="pull-left">
<span class="game-result">1</span>
<span class="game-result">0</span>
</div>
<div class="result">
<i class="icon-square-minus loss" tip="Lost"></i>
</div>
</a>
</td>
<td class="text-center">
<a class="clickable-link" href="https://www.chess.com/live/game/2249663029?username=belemnarmada" target="_self">30 min</a>
</td>
<td class="text-right">
<a class="clickable-link text-middle moves" href="https://www.chess.com/live/game/2249663029?username=belemnarmada" target="_self">25</a>
</td>
<td class="text-right miniboard">
<a class="clickable-link archive-date" href="https://www.chess.com/live/game/2249663029?username=belemnarmada" target="_self">Aug 9, 2017</a>
</td>
</tr>
100 <tr></tr> here
</tbody>
</table>


My code stops here, how do I write the python code to loop all the <tr></tr> pair and extract all the class for each <span> pair in each <td> pair?



edit



I think maybe I didn't explain clearly here, what your code returns are the name of class in that HTML while what I am looking for are the correspondent values, e.g. there is a class username, I want to get its value of player1 and player2; there is a class country-flag-small flag-70 I want to get tip=Indonesia










share|improve this question



















  • 2





    Where is your code please? You have been a member for 7 years so you know how it works for debugging questions.

    – QHarr
    Mar 9 at 6:10











  • How long have you been here, please? wouldn't you provide any constructive answer here like others instead of being mean to someone you don't know?

    – mdivk
    Mar 9 at 13:48






  • 1





    it is not rude imo but I apologise if any offence was given. I ask for the code. It is very clear that we expect that for questions that seek debugging help. But if helps please see How to Ask and Minimal, Complete, and Verifiable example.

    – QHarr
    Mar 9 at 13:53


















2















I just started using python for some web page scraping and BeautifulSoup seems to be recommended everywhere.



I have the content like below:



<table class="table with-row-highlight table-archive">
<tbody>
<tr>
<td>
<div class="user-tagline ">
<span class="username " data-avatar="aaaaaaa">player1</span>
<span class="user-rating">(1357)</span>
<span class="country-flag-small flag-113" tip="Portugal"></span>
</div>
<div class="user-tagline ">
<span class="username " data-avatar="bbbbbbb">player2</span>
<span class="user-rating">(1387)</span>
<span class="country-flag-small flag-70" tip="Indonesia"></span>
</div>
</td>
<td>
<a class="clickable-link text-middle" href="https://www.chess.com/live/game/2249663029?username=belemnarmada" target="_self">
<div class="pull-left">
<span class="game-result">1</span>
<span class="game-result">0</span>
</div>
<div class="result">
<i class="icon-square-minus loss" tip="Lost"></i>
</div>
</a>
</td>
<td class="text-center">
<a class="clickable-link" href="https://www.chess.com/live/game/2249663029?username=belemnarmada" target="_self">30 min</a>
</td>
<td class="text-right">
<a class="clickable-link text-middle moves" href="https://www.chess.com/live/game/2249663029?username=belemnarmada" target="_self">25</a>
</td>
<td class="text-right miniboard">
<a class="clickable-link archive-date" href="https://www.chess.com/live/game/2249663029?username=belemnarmada" target="_self">Aug 9, 2017</a>
</td>
</tr>
100 <tr></tr> here
</tbody>
</table>


My code stops here, how do I write the python code to loop all the <tr></tr> pair and extract all the class for each <span> pair in each <td> pair?



edit



I think maybe I didn't explain clearly here, what your code returns are the name of class in that HTML while what I am looking for are the correspondent values, e.g. there is a class username, I want to get its value of player1 and player2; there is a class country-flag-small flag-70 I want to get tip=Indonesia










share|improve this question



















  • 2





    Where is your code please? You have been a member for 7 years so you know how it works for debugging questions.

    – QHarr
    Mar 9 at 6:10











  • How long have you been here, please? wouldn't you provide any constructive answer here like others instead of being mean to someone you don't know?

    – mdivk
    Mar 9 at 13:48






  • 1





    it is not rude imo but I apologise if any offence was given. I ask for the code. It is very clear that we expect that for questions that seek debugging help. But if helps please see How to Ask and Minimal, Complete, and Verifiable example.

    – QHarr
    Mar 9 at 13:53














2












2








2








I just started using python for some web page scraping and BeautifulSoup seems to be recommended everywhere.



I have the content like below:



<table class="table with-row-highlight table-archive">
<tbody>
<tr>
<td>
<div class="user-tagline ">
<span class="username " data-avatar="aaaaaaa">player1</span>
<span class="user-rating">(1357)</span>
<span class="country-flag-small flag-113" tip="Portugal"></span>
</div>
<div class="user-tagline ">
<span class="username " data-avatar="bbbbbbb">player2</span>
<span class="user-rating">(1387)</span>
<span class="country-flag-small flag-70" tip="Indonesia"></span>
</div>
</td>
<td>
<a class="clickable-link text-middle" href="https://www.chess.com/live/game/2249663029?username=belemnarmada" target="_self">
<div class="pull-left">
<span class="game-result">1</span>
<span class="game-result">0</span>
</div>
<div class="result">
<i class="icon-square-minus loss" tip="Lost"></i>
</div>
</a>
</td>
<td class="text-center">
<a class="clickable-link" href="https://www.chess.com/live/game/2249663029?username=belemnarmada" target="_self">30 min</a>
</td>
<td class="text-right">
<a class="clickable-link text-middle moves" href="https://www.chess.com/live/game/2249663029?username=belemnarmada" target="_self">25</a>
</td>
<td class="text-right miniboard">
<a class="clickable-link archive-date" href="https://www.chess.com/live/game/2249663029?username=belemnarmada" target="_self">Aug 9, 2017</a>
</td>
</tr>
100 <tr></tr> here
</tbody>
</table>


My code stops here, how do I write the python code to loop all the <tr></tr> pair and extract all the class for each <span> pair in each <td> pair?



edit



I think maybe I didn't explain clearly here, what your code returns are the name of class in that HTML while what I am looking for are the correspondent values, e.g. there is a class username, I want to get its value of player1 and player2; there is a class country-flag-small flag-70 I want to get tip=Indonesia










share|improve this question
















I just started using python for some web page scraping and BeautifulSoup seems to be recommended everywhere.



I have the content like below:



<table class="table with-row-highlight table-archive">
<tbody>
<tr>
<td>
<div class="user-tagline ">
<span class="username " data-avatar="aaaaaaa">player1</span>
<span class="user-rating">(1357)</span>
<span class="country-flag-small flag-113" tip="Portugal"></span>
</div>
<div class="user-tagline ">
<span class="username " data-avatar="bbbbbbb">player2</span>
<span class="user-rating">(1387)</span>
<span class="country-flag-small flag-70" tip="Indonesia"></span>
</div>
</td>
<td>
<a class="clickable-link text-middle" href="https://www.chess.com/live/game/2249663029?username=belemnarmada" target="_self">
<div class="pull-left">
<span class="game-result">1</span>
<span class="game-result">0</span>
</div>
<div class="result">
<i class="icon-square-minus loss" tip="Lost"></i>
</div>
</a>
</td>
<td class="text-center">
<a class="clickable-link" href="https://www.chess.com/live/game/2249663029?username=belemnarmada" target="_self">30 min</a>
</td>
<td class="text-right">
<a class="clickable-link text-middle moves" href="https://www.chess.com/live/game/2249663029?username=belemnarmada" target="_self">25</a>
</td>
<td class="text-right miniboard">
<a class="clickable-link archive-date" href="https://www.chess.com/live/game/2249663029?username=belemnarmada" target="_self">Aug 9, 2017</a>
</td>
</tr>
100 <tr></tr> here
</tbody>
</table>


My code stops here, how do I write the python code to loop all the <tr></tr> pair and extract all the class for each <span> pair in each <td> pair?



edit



I think maybe I didn't explain clearly here, what your code returns are the name of class in that HTML while what I am looking for are the correspondent values, e.g. there is a class username, I want to get its value of player1 and player2; there is a class country-flag-small flag-70 I want to get tip=Indonesia







python html beautifulsoup






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 10 at 12:04









Mr Lister

35.7k1078121




35.7k1078121










asked Mar 9 at 4:23









mdivkmdivk

80531428




80531428







  • 2





    Where is your code please? You have been a member for 7 years so you know how it works for debugging questions.

    – QHarr
    Mar 9 at 6:10











  • How long have you been here, please? wouldn't you provide any constructive answer here like others instead of being mean to someone you don't know?

    – mdivk
    Mar 9 at 13:48






  • 1





    it is not rude imo but I apologise if any offence was given. I ask for the code. It is very clear that we expect that for questions that seek debugging help. But if helps please see How to Ask and Minimal, Complete, and Verifiable example.

    – QHarr
    Mar 9 at 13:53













  • 2





    Where is your code please? You have been a member for 7 years so you know how it works for debugging questions.

    – QHarr
    Mar 9 at 6:10











  • How long have you been here, please? wouldn't you provide any constructive answer here like others instead of being mean to someone you don't know?

    – mdivk
    Mar 9 at 13:48






  • 1





    it is not rude imo but I apologise if any offence was given. I ask for the code. It is very clear that we expect that for questions that seek debugging help. But if helps please see How to Ask and Minimal, Complete, and Verifiable example.

    – QHarr
    Mar 9 at 13:53








2




2





Where is your code please? You have been a member for 7 years so you know how it works for debugging questions.

– QHarr
Mar 9 at 6:10





Where is your code please? You have been a member for 7 years so you know how it works for debugging questions.

– QHarr
Mar 9 at 6:10













How long have you been here, please? wouldn't you provide any constructive answer here like others instead of being mean to someone you don't know?

– mdivk
Mar 9 at 13:48





How long have you been here, please? wouldn't you provide any constructive answer here like others instead of being mean to someone you don't know?

– mdivk
Mar 9 at 13:48




1




1





it is not rude imo but I apologise if any offence was given. I ask for the code. It is very clear that we expect that for questions that seek debugging help. But if helps please see How to Ask and Minimal, Complete, and Verifiable example.

– QHarr
Mar 9 at 13:53






it is not rude imo but I apologise if any offence was given. I ask for the code. It is very clear that we expect that for questions that seek debugging help. But if helps please see How to Ask and Minimal, Complete, and Verifiable example.

– QHarr
Mar 9 at 13:53













1 Answer
1






active

oldest

votes


















0














This should do the trick:



import requests
from bs4 import BeautifulSoup

res = requests.get('someLink')
soup = BeautifulSoup(res.text)


classes = []
for element in soup.find_all(class_=True):
classes.extend(element["class"])
print(classes)


I tested this using your html file and got the following results:



['table', 'with-row-highlight', 'table-archive', 'user-tagline', 'username', 'user-rating', 'country-flag-small', 'flag-113', 'user-tagline', 'username', 'user-rating', 'country-flag-small','flag-70', 'clickable-link', 'text-middle', 'pull-left', 'game-result', 'game-result', 'result', 'icon-square-minus', 'loss', 'text-center', 'clickable-link', 'text-right', 'clickable-link', 'text-middle', 'moves', 'text-right', 'miniboard', 'clickable-link', 'archive-date']


Do note that you will have to pip3 install requests if you haven't already



Also, if you want to test this with a file on your computer, you can do this:



from bs4 import BeautifulSoup

file = open('/path/To/Your/HtmlFile.html', 'r')
lines = file.read()
soup = BeautifulSoup(lines)


classes = []
for element in soup.find_all(class_=True):
classes.extend(element["class"])
print(classes)





share|improve this answer























  • Thank you Jane for the answer, trying to replicate the result here but see some unexpected error here: snag.gy/uJRSYo.jpg

    – mdivk
    Mar 9 at 13:54











  • I am able to run your code in Windows now, thank you very much and will update here if there are more questions.

    – mdivk
    Mar 9 at 14:12











  • I think maybe I didn't explain clearly here, what your code returns are the name of class in that HTML while what I am looking for are the correspondent values, e.g. there is a class "username ", I want to get its value of "player1 and player2; there is a class "country-flag-small flag-70" I want to get tip="Indonesia"

    – mdivk
    Mar 9 at 14:17












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55073967%2fhow-to-get-value-from-piece-of-html-code-with-beautifulsoup%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














This should do the trick:



import requests
from bs4 import BeautifulSoup

res = requests.get('someLink')
soup = BeautifulSoup(res.text)


classes = []
for element in soup.find_all(class_=True):
classes.extend(element["class"])
print(classes)


I tested this using your html file and got the following results:



['table', 'with-row-highlight', 'table-archive', 'user-tagline', 'username', 'user-rating', 'country-flag-small', 'flag-113', 'user-tagline', 'username', 'user-rating', 'country-flag-small','flag-70', 'clickable-link', 'text-middle', 'pull-left', 'game-result', 'game-result', 'result', 'icon-square-minus', 'loss', 'text-center', 'clickable-link', 'text-right', 'clickable-link', 'text-middle', 'moves', 'text-right', 'miniboard', 'clickable-link', 'archive-date']


Do note that you will have to pip3 install requests if you haven't already



Also, if you want to test this with a file on your computer, you can do this:



from bs4 import BeautifulSoup

file = open('/path/To/Your/HtmlFile.html', 'r')
lines = file.read()
soup = BeautifulSoup(lines)


classes = []
for element in soup.find_all(class_=True):
classes.extend(element["class"])
print(classes)





share|improve this answer























  • Thank you Jane for the answer, trying to replicate the result here but see some unexpected error here: snag.gy/uJRSYo.jpg

    – mdivk
    Mar 9 at 13:54











  • I am able to run your code in Windows now, thank you very much and will update here if there are more questions.

    – mdivk
    Mar 9 at 14:12











  • I think maybe I didn't explain clearly here, what your code returns are the name of class in that HTML while what I am looking for are the correspondent values, e.g. there is a class "username ", I want to get its value of "player1 and player2; there is a class "country-flag-small flag-70" I want to get tip="Indonesia"

    – mdivk
    Mar 9 at 14:17
















0














This should do the trick:



import requests
from bs4 import BeautifulSoup

res = requests.get('someLink')
soup = BeautifulSoup(res.text)


classes = []
for element in soup.find_all(class_=True):
classes.extend(element["class"])
print(classes)


I tested this using your html file and got the following results:



['table', 'with-row-highlight', 'table-archive', 'user-tagline', 'username', 'user-rating', 'country-flag-small', 'flag-113', 'user-tagline', 'username', 'user-rating', 'country-flag-small','flag-70', 'clickable-link', 'text-middle', 'pull-left', 'game-result', 'game-result', 'result', 'icon-square-minus', 'loss', 'text-center', 'clickable-link', 'text-right', 'clickable-link', 'text-middle', 'moves', 'text-right', 'miniboard', 'clickable-link', 'archive-date']


Do note that you will have to pip3 install requests if you haven't already



Also, if you want to test this with a file on your computer, you can do this:



from bs4 import BeautifulSoup

file = open('/path/To/Your/HtmlFile.html', 'r')
lines = file.read()
soup = BeautifulSoup(lines)


classes = []
for element in soup.find_all(class_=True):
classes.extend(element["class"])
print(classes)





share|improve this answer























  • Thank you Jane for the answer, trying to replicate the result here but see some unexpected error here: snag.gy/uJRSYo.jpg

    – mdivk
    Mar 9 at 13:54











  • I am able to run your code in Windows now, thank you very much and will update here if there are more questions.

    – mdivk
    Mar 9 at 14:12











  • I think maybe I didn't explain clearly here, what your code returns are the name of class in that HTML while what I am looking for are the correspondent values, e.g. there is a class "username ", I want to get its value of "player1 and player2; there is a class "country-flag-small flag-70" I want to get tip="Indonesia"

    – mdivk
    Mar 9 at 14:17














0












0








0







This should do the trick:



import requests
from bs4 import BeautifulSoup

res = requests.get('someLink')
soup = BeautifulSoup(res.text)


classes = []
for element in soup.find_all(class_=True):
classes.extend(element["class"])
print(classes)


I tested this using your html file and got the following results:



['table', 'with-row-highlight', 'table-archive', 'user-tagline', 'username', 'user-rating', 'country-flag-small', 'flag-113', 'user-tagline', 'username', 'user-rating', 'country-flag-small','flag-70', 'clickable-link', 'text-middle', 'pull-left', 'game-result', 'game-result', 'result', 'icon-square-minus', 'loss', 'text-center', 'clickable-link', 'text-right', 'clickable-link', 'text-middle', 'moves', 'text-right', 'miniboard', 'clickable-link', 'archive-date']


Do note that you will have to pip3 install requests if you haven't already



Also, if you want to test this with a file on your computer, you can do this:



from bs4 import BeautifulSoup

file = open('/path/To/Your/HtmlFile.html', 'r')
lines = file.read()
soup = BeautifulSoup(lines)


classes = []
for element in soup.find_all(class_=True):
classes.extend(element["class"])
print(classes)





share|improve this answer













This should do the trick:



import requests
from bs4 import BeautifulSoup

res = requests.get('someLink')
soup = BeautifulSoup(res.text)


classes = []
for element in soup.find_all(class_=True):
classes.extend(element["class"])
print(classes)


I tested this using your html file and got the following results:



['table', 'with-row-highlight', 'table-archive', 'user-tagline', 'username', 'user-rating', 'country-flag-small', 'flag-113', 'user-tagline', 'username', 'user-rating', 'country-flag-small','flag-70', 'clickable-link', 'text-middle', 'pull-left', 'game-result', 'game-result', 'result', 'icon-square-minus', 'loss', 'text-center', 'clickable-link', 'text-right', 'clickable-link', 'text-middle', 'moves', 'text-right', 'miniboard', 'clickable-link', 'archive-date']


Do note that you will have to pip3 install requests if you haven't already



Also, if you want to test this with a file on your computer, you can do this:



from bs4 import BeautifulSoup

file = open('/path/To/Your/HtmlFile.html', 'r')
lines = file.read()
soup = BeautifulSoup(lines)


classes = []
for element in soup.find_all(class_=True):
classes.extend(element["class"])
print(classes)






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 9 at 5:28









Caleb GoodmanCaleb Goodman

1,2161518




1,2161518












  • Thank you Jane for the answer, trying to replicate the result here but see some unexpected error here: snag.gy/uJRSYo.jpg

    – mdivk
    Mar 9 at 13:54











  • I am able to run your code in Windows now, thank you very much and will update here if there are more questions.

    – mdivk
    Mar 9 at 14:12











  • I think maybe I didn't explain clearly here, what your code returns are the name of class in that HTML while what I am looking for are the correspondent values, e.g. there is a class "username ", I want to get its value of "player1 and player2; there is a class "country-flag-small flag-70" I want to get tip="Indonesia"

    – mdivk
    Mar 9 at 14:17


















  • Thank you Jane for the answer, trying to replicate the result here but see some unexpected error here: snag.gy/uJRSYo.jpg

    – mdivk
    Mar 9 at 13:54











  • I am able to run your code in Windows now, thank you very much and will update here if there are more questions.

    – mdivk
    Mar 9 at 14:12











  • I think maybe I didn't explain clearly here, what your code returns are the name of class in that HTML while what I am looking for are the correspondent values, e.g. there is a class "username ", I want to get its value of "player1 and player2; there is a class "country-flag-small flag-70" I want to get tip="Indonesia"

    – mdivk
    Mar 9 at 14:17

















Thank you Jane for the answer, trying to replicate the result here but see some unexpected error here: snag.gy/uJRSYo.jpg

– mdivk
Mar 9 at 13:54





Thank you Jane for the answer, trying to replicate the result here but see some unexpected error here: snag.gy/uJRSYo.jpg

– mdivk
Mar 9 at 13:54













I am able to run your code in Windows now, thank you very much and will update here if there are more questions.

– mdivk
Mar 9 at 14:12





I am able to run your code in Windows now, thank you very much and will update here if there are more questions.

– mdivk
Mar 9 at 14:12













I think maybe I didn't explain clearly here, what your code returns are the name of class in that HTML while what I am looking for are the correspondent values, e.g. there is a class "username ", I want to get its value of "player1 and player2; there is a class "country-flag-small flag-70" I want to get tip="Indonesia"

– mdivk
Mar 9 at 14:17






I think maybe I didn't explain clearly here, what your code returns are the name of class in that HTML while what I am looking for are the correspondent values, e.g. there is a class "username ", I want to get its value of "player1 and player2; there is a class "country-flag-small flag-70" I want to get tip="Indonesia"

– mdivk
Mar 9 at 14:17




















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55073967%2fhow-to-get-value-from-piece-of-html-code-with-beautifulsoup%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

1928 у кіно

Захаров Федір Захарович

Ель Греко