BeautifulSoup “AttributeError: 'NoneType' object has no attribute 'text'”What are valid values for the id attribute in HTML?How to know if an object has an attribute in PythonHow do I give text or an image a transparent background using CSS?Determine the type of an object?How do I vertically center text with CSS?What is the purpose of the “role” attribute in HTML?extract label value for checkbox input object with beautiful soup instead of mechanize in pythonWeb scraping on stock market - AttributeError: 'NoneType' object has no attribute 'text'I am getting text error while the code is appicable for on company using python beautifulsoupProblem in scraping data in non-english character sites [Python]

What to look for in climbing shoes?

Manually select/unselect lines before forwarding to stdout

Index Uniqueness Overhead

Accidentally deleted python and yum is not working in centos7

What is the technical explanation of the note "A♭" in a F7 chord in the key of C?

Why did Steve Rogers choose Sam in Endgame?

Why did Spider-Man take a detour to Dorset?

Was all the fuel expended in each stage of a Saturn V launch?

Why are road bikes (not time trial bikes) used in many triathlons?

Do First Order blasters maintain a record of when they were fired?

Are the errors in this formulation of the simple linear regression model random variables?

Is it rude to refer to janitors as 'floor people'?

What's the meaning of こそ in this sentence?

Advice for paying off student loans and auto loans now that I have my first 'real' job

Can a Resident Assistant Be Told to Ignore a Lawful Order?

Can a pizza stone be fixed after soap has been used to clean it?

In Adventurers League, is there any way for an 5th-level wizard to gain heavy armor proficiency?

MQTT subscription topic match

Why do legislative committees exist?

Is there a way to handmake alphabet pasta?

Too many spies!

Extension of trace on von Neumann subalgebra

How could an animal "smell" carbon monoxide?

Video editor for YouTube



BeautifulSoup “AttributeError: 'NoneType' object has no attribute 'text'”


What are valid values for the id attribute in HTML?How to know if an object has an attribute in PythonHow do I give text or an image a transparent background using CSS?Determine the type of an object?How do I vertically center text with CSS?What is the purpose of the “role” attribute in HTML?extract label value for checkbox input object with beautiful soup instead of mechanize in pythonWeb scraping on stock market - AttributeError: 'NoneType' object has no attribute 'text'I am getting text error while the code is appicable for on company using python beautifulsoupProblem in scraping data in non-english character sites [Python]






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I was web-scraping weather-searched Google with bs4, and Python can't find a <span> tag when there is one. How can I solve this problem?



I tried to find this <span> with the class and the id, but both failed.



<div id="wob_dcp">
<span class="vk_gy vk_sh" id="wob_dc">Clear with periodic clouds</span>
</div>


Above is the HTML code I was trying to scrape in the page:



Sorry, I can't post images because of the reputation^^;



response = requests.get('https://www.google.com/search?hl=ja&ei=coGHXPWEIouUr7wPo9ixoAg&q=%EC%9D%BC%EB%B3%B8+%E6%A1%9C%E5%B7%9D%E5%B8%82%E7%9C%9F%E5%A3%81%E7%94%BA%E5%8F%A4%E5%9F%8E+%EB%82%B4%EC%9D%BC+%EB%82%A0%EC%94%A8&oq=%EC%9D%BC%EB%B3%B8+%E6%A1%9C%E5%B7%9D%E5%B8%82%E7%9C%9F%E5%A3%81%E7%94%BA%E5%8F%A4%E5%9F%8E+%EB%82%B4%EC%9D%BC+%EB%82%A0%EC%94%A8&gs_l=psy-ab.3...232674.234409..234575...0.0..0.251.929.0j6j1......0....1..gws-wiz.......35i39.yu0YE6lnCms')
soup = BeautifulSoup(response.content, 'html.parser')

tomorrow_weather = soup.find('span', 'id': 'wob_dc').text


But failed with this code, the error is:



Traceback (most recent call last):
File "C:Userssungn_000Desktopweather.py", line 23, in <module>
tomorrow_weather = soup.find('span', 'id': 'wob_dc').text
AttributeError: 'NoneType' object has no attribute 'text'


Please solve this error.










share|improve this question
























  • Please post a valid url of the page instead of a micro-image. Thank you!

    – DirtyBit
    Mar 26 at 7:34












  • Still cannot reproduce it: ibb.co/zJM1svX

    – DirtyBit
    Mar 26 at 7:41











  • You can use Chrome.

    – sjk1204
    Mar 26 at 7:51











  • Doesn't work for me either with chrome. Is it supposed to get an actual page or just the search results? That id is not present when I inspect.

    – QHarr
    Mar 26 at 8:07


















0















I was web-scraping weather-searched Google with bs4, and Python can't find a <span> tag when there is one. How can I solve this problem?



I tried to find this <span> with the class and the id, but both failed.



<div id="wob_dcp">
<span class="vk_gy vk_sh" id="wob_dc">Clear with periodic clouds</span>
</div>


Above is the HTML code I was trying to scrape in the page:



Sorry, I can't post images because of the reputation^^;



response = requests.get('https://www.google.com/search?hl=ja&ei=coGHXPWEIouUr7wPo9ixoAg&q=%EC%9D%BC%EB%B3%B8+%E6%A1%9C%E5%B7%9D%E5%B8%82%E7%9C%9F%E5%A3%81%E7%94%BA%E5%8F%A4%E5%9F%8E+%EB%82%B4%EC%9D%BC+%EB%82%A0%EC%94%A8&oq=%EC%9D%BC%EB%B3%B8+%E6%A1%9C%E5%B7%9D%E5%B8%82%E7%9C%9F%E5%A3%81%E7%94%BA%E5%8F%A4%E5%9F%8E+%EB%82%B4%EC%9D%BC+%EB%82%A0%EC%94%A8&gs_l=psy-ab.3...232674.234409..234575...0.0..0.251.929.0j6j1......0....1..gws-wiz.......35i39.yu0YE6lnCms')
soup = BeautifulSoup(response.content, 'html.parser')

tomorrow_weather = soup.find('span', 'id': 'wob_dc').text


But failed with this code, the error is:



Traceback (most recent call last):
File "C:Userssungn_000Desktopweather.py", line 23, in <module>
tomorrow_weather = soup.find('span', 'id': 'wob_dc').text
AttributeError: 'NoneType' object has no attribute 'text'


Please solve this error.










share|improve this question
























  • Please post a valid url of the page instead of a micro-image. Thank you!

    – DirtyBit
    Mar 26 at 7:34












  • Still cannot reproduce it: ibb.co/zJM1svX

    – DirtyBit
    Mar 26 at 7:41











  • You can use Chrome.

    – sjk1204
    Mar 26 at 7:51











  • Doesn't work for me either with chrome. Is it supposed to get an actual page or just the search results? That id is not present when I inspect.

    – QHarr
    Mar 26 at 8:07














0












0








0








I was web-scraping weather-searched Google with bs4, and Python can't find a <span> tag when there is one. How can I solve this problem?



I tried to find this <span> with the class and the id, but both failed.



<div id="wob_dcp">
<span class="vk_gy vk_sh" id="wob_dc">Clear with periodic clouds</span>
</div>


Above is the HTML code I was trying to scrape in the page:



Sorry, I can't post images because of the reputation^^;



response = requests.get('https://www.google.com/search?hl=ja&ei=coGHXPWEIouUr7wPo9ixoAg&q=%EC%9D%BC%EB%B3%B8+%E6%A1%9C%E5%B7%9D%E5%B8%82%E7%9C%9F%E5%A3%81%E7%94%BA%E5%8F%A4%E5%9F%8E+%EB%82%B4%EC%9D%BC+%EB%82%A0%EC%94%A8&oq=%EC%9D%BC%EB%B3%B8+%E6%A1%9C%E5%B7%9D%E5%B8%82%E7%9C%9F%E5%A3%81%E7%94%BA%E5%8F%A4%E5%9F%8E+%EB%82%B4%EC%9D%BC+%EB%82%A0%EC%94%A8&gs_l=psy-ab.3...232674.234409..234575...0.0..0.251.929.0j6j1......0....1..gws-wiz.......35i39.yu0YE6lnCms')
soup = BeautifulSoup(response.content, 'html.parser')

tomorrow_weather = soup.find('span', 'id': 'wob_dc').text


But failed with this code, the error is:



Traceback (most recent call last):
File "C:Userssungn_000Desktopweather.py", line 23, in <module>
tomorrow_weather = soup.find('span', 'id': 'wob_dc').text
AttributeError: 'NoneType' object has no attribute 'text'


Please solve this error.










share|improve this question
















I was web-scraping weather-searched Google with bs4, and Python can't find a <span> tag when there is one. How can I solve this problem?



I tried to find this <span> with the class and the id, but both failed.



<div id="wob_dcp">
<span class="vk_gy vk_sh" id="wob_dc">Clear with periodic clouds</span>
</div>


Above is the HTML code I was trying to scrape in the page:



Sorry, I can't post images because of the reputation^^;



response = requests.get('https://www.google.com/search?hl=ja&ei=coGHXPWEIouUr7wPo9ixoAg&q=%EC%9D%BC%EB%B3%B8+%E6%A1%9C%E5%B7%9D%E5%B8%82%E7%9C%9F%E5%A3%81%E7%94%BA%E5%8F%A4%E5%9F%8E+%EB%82%B4%EC%9D%BC+%EB%82%A0%EC%94%A8&oq=%EC%9D%BC%EB%B3%B8+%E6%A1%9C%E5%B7%9D%E5%B8%82%E7%9C%9F%E5%A3%81%E7%94%BA%E5%8F%A4%E5%9F%8E+%EB%82%B4%EC%9D%BC+%EB%82%A0%EC%94%A8&gs_l=psy-ab.3...232674.234409..234575...0.0..0.251.929.0j6j1......0....1..gws-wiz.......35i39.yu0YE6lnCms')
soup = BeautifulSoup(response.content, 'html.parser')

tomorrow_weather = soup.find('span', 'id': 'wob_dc').text


But failed with this code, the error is:



Traceback (most recent call last):
File "C:Userssungn_000Desktopweather.py", line 23, in <module>
tomorrow_weather = soup.find('span', 'id': 'wob_dc').text
AttributeError: 'NoneType' object has no attribute 'text'


Please solve this error.







python html web-scraping beautifulsoup






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 7:37







sjk1204

















asked Mar 26 at 7:33









sjk1204sjk1204

135 bronze badges




135 bronze badges












  • Please post a valid url of the page instead of a micro-image. Thank you!

    – DirtyBit
    Mar 26 at 7:34












  • Still cannot reproduce it: ibb.co/zJM1svX

    – DirtyBit
    Mar 26 at 7:41











  • You can use Chrome.

    – sjk1204
    Mar 26 at 7:51











  • Doesn't work for me either with chrome. Is it supposed to get an actual page or just the search results? That id is not present when I inspect.

    – QHarr
    Mar 26 at 8:07


















  • Please post a valid url of the page instead of a micro-image. Thank you!

    – DirtyBit
    Mar 26 at 7:34












  • Still cannot reproduce it: ibb.co/zJM1svX

    – DirtyBit
    Mar 26 at 7:41











  • You can use Chrome.

    – sjk1204
    Mar 26 at 7:51











  • Doesn't work for me either with chrome. Is it supposed to get an actual page or just the search results? That id is not present when I inspect.

    – QHarr
    Mar 26 at 8:07

















Please post a valid url of the page instead of a micro-image. Thank you!

– DirtyBit
Mar 26 at 7:34






Please post a valid url of the page instead of a micro-image. Thank you!

– DirtyBit
Mar 26 at 7:34














Still cannot reproduce it: ibb.co/zJM1svX

– DirtyBit
Mar 26 at 7:41





Still cannot reproduce it: ibb.co/zJM1svX

– DirtyBit
Mar 26 at 7:41













You can use Chrome.

– sjk1204
Mar 26 at 7:51





You can use Chrome.

– sjk1204
Mar 26 at 7:51













Doesn't work for me either with chrome. Is it supposed to get an actual page or just the search results? That id is not present when I inspect.

– QHarr
Mar 26 at 8:07






Doesn't work for me either with chrome. Is it supposed to get an actual page or just the search results? That id is not present when I inspect.

– QHarr
Mar 26 at 8:07













2 Answers
2






active

oldest

votes


















4














This is because the weather section is rendered by the browser via JavaScript. So when you use requests you only get the HTML content of the page which doesn't have what you need.
You should use for example selenium (or requests-html) if you want to parse page with elements rendered by web browser.



from bs4 import BeautifulSoup
from requests_html import HTMLSession
session = HTMLSession()
response = session.get('https://www.google.com/search?hl=en&ei=coGHXPWEIouUr7wPo9ixoAg&q=%EC%9D%BC%EB%B3%B8%20%E6%A1%9C%E5%B7%9D%E5%B8%82%E7%9C%9F%E5%A3%81%E7%94%BA%E5%8F%A4%E5%9F%8E%20%EB%82%B4%EC%9D%BC%20%EB%82%A0%EC%94%A8&oq=%EC%9D%BC%EB%B3%B8%20%E6%A1%9C%E5%B7%9D%E5%B8%82%E7%9C%9F%E5%A3%81%E7%94%BA%E5%8F%A4%E5%9F%8E%20%EB%82%B4%EC%9D%BC%20%EB%82%A0%EC%94%A8&gs_l=psy-ab.3...232674.234409..234575...0.0..0.251.929.0j6j1......0....1..gws-wiz.......35i39.yu0YE6lnCms')
soup = BeautifulSoup(response.content, 'html.parser')

tomorrow_weather = soup.find('span', 'id': 'wob_dc').text
print(tomorrow_weather)


Output:



pawel@pawel-XPS-15-9570:~$ python test.py
Clear with periodic clouds





share|improve this answer

























  • Thanks a lot! With requests-html, it finally worked!

    – sjk1204
    Mar 26 at 8:05


















0














>>> from bs4 import BeautifulSoup
>>> soup = BeautifulSoup(a)
>>> a
'<div id="wob_dcp">n <span class="vk_gy vk_sh" id="wob_dc">Clear with periodic clouds</span> n</div>'
>>> soup.find("span", id="wob_dc").text
'Clear with periodic clouds'


Try this out.






share|improve this answer

























  • Obviously this works, but this is not the answer to the question. He requires it using requests.

    – DirtyBit
    Mar 26 at 7:44











  • If you inspect the response.content of request.get you won't find span in the content. It is because Javascript rendering the HTML and you don't get what you intending.

    – Pravin
    Mar 26 at 7:53














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%2f55351871%2fbeautifulsoup-attributeerror-nonetype-object-has-no-attribute-text%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









4














This is because the weather section is rendered by the browser via JavaScript. So when you use requests you only get the HTML content of the page which doesn't have what you need.
You should use for example selenium (or requests-html) if you want to parse page with elements rendered by web browser.



from bs4 import BeautifulSoup
from requests_html import HTMLSession
session = HTMLSession()
response = session.get('https://www.google.com/search?hl=en&ei=coGHXPWEIouUr7wPo9ixoAg&q=%EC%9D%BC%EB%B3%B8%20%E6%A1%9C%E5%B7%9D%E5%B8%82%E7%9C%9F%E5%A3%81%E7%94%BA%E5%8F%A4%E5%9F%8E%20%EB%82%B4%EC%9D%BC%20%EB%82%A0%EC%94%A8&oq=%EC%9D%BC%EB%B3%B8%20%E6%A1%9C%E5%B7%9D%E5%B8%82%E7%9C%9F%E5%A3%81%E7%94%BA%E5%8F%A4%E5%9F%8E%20%EB%82%B4%EC%9D%BC%20%EB%82%A0%EC%94%A8&gs_l=psy-ab.3...232674.234409..234575...0.0..0.251.929.0j6j1......0....1..gws-wiz.......35i39.yu0YE6lnCms')
soup = BeautifulSoup(response.content, 'html.parser')

tomorrow_weather = soup.find('span', 'id': 'wob_dc').text
print(tomorrow_weather)


Output:



pawel@pawel-XPS-15-9570:~$ python test.py
Clear with periodic clouds





share|improve this answer

























  • Thanks a lot! With requests-html, it finally worked!

    – sjk1204
    Mar 26 at 8:05















4














This is because the weather section is rendered by the browser via JavaScript. So when you use requests you only get the HTML content of the page which doesn't have what you need.
You should use for example selenium (or requests-html) if you want to parse page with elements rendered by web browser.



from bs4 import BeautifulSoup
from requests_html import HTMLSession
session = HTMLSession()
response = session.get('https://www.google.com/search?hl=en&ei=coGHXPWEIouUr7wPo9ixoAg&q=%EC%9D%BC%EB%B3%B8%20%E6%A1%9C%E5%B7%9D%E5%B8%82%E7%9C%9F%E5%A3%81%E7%94%BA%E5%8F%A4%E5%9F%8E%20%EB%82%B4%EC%9D%BC%20%EB%82%A0%EC%94%A8&oq=%EC%9D%BC%EB%B3%B8%20%E6%A1%9C%E5%B7%9D%E5%B8%82%E7%9C%9F%E5%A3%81%E7%94%BA%E5%8F%A4%E5%9F%8E%20%EB%82%B4%EC%9D%BC%20%EB%82%A0%EC%94%A8&gs_l=psy-ab.3...232674.234409..234575...0.0..0.251.929.0j6j1......0....1..gws-wiz.......35i39.yu0YE6lnCms')
soup = BeautifulSoup(response.content, 'html.parser')

tomorrow_weather = soup.find('span', 'id': 'wob_dc').text
print(tomorrow_weather)


Output:



pawel@pawel-XPS-15-9570:~$ python test.py
Clear with periodic clouds





share|improve this answer

























  • Thanks a lot! With requests-html, it finally worked!

    – sjk1204
    Mar 26 at 8:05













4












4








4







This is because the weather section is rendered by the browser via JavaScript. So when you use requests you only get the HTML content of the page which doesn't have what you need.
You should use for example selenium (or requests-html) if you want to parse page with elements rendered by web browser.



from bs4 import BeautifulSoup
from requests_html import HTMLSession
session = HTMLSession()
response = session.get('https://www.google.com/search?hl=en&ei=coGHXPWEIouUr7wPo9ixoAg&q=%EC%9D%BC%EB%B3%B8%20%E6%A1%9C%E5%B7%9D%E5%B8%82%E7%9C%9F%E5%A3%81%E7%94%BA%E5%8F%A4%E5%9F%8E%20%EB%82%B4%EC%9D%BC%20%EB%82%A0%EC%94%A8&oq=%EC%9D%BC%EB%B3%B8%20%E6%A1%9C%E5%B7%9D%E5%B8%82%E7%9C%9F%E5%A3%81%E7%94%BA%E5%8F%A4%E5%9F%8E%20%EB%82%B4%EC%9D%BC%20%EB%82%A0%EC%94%A8&gs_l=psy-ab.3...232674.234409..234575...0.0..0.251.929.0j6j1......0....1..gws-wiz.......35i39.yu0YE6lnCms')
soup = BeautifulSoup(response.content, 'html.parser')

tomorrow_weather = soup.find('span', 'id': 'wob_dc').text
print(tomorrow_weather)


Output:



pawel@pawel-XPS-15-9570:~$ python test.py
Clear with periodic clouds





share|improve this answer















This is because the weather section is rendered by the browser via JavaScript. So when you use requests you only get the HTML content of the page which doesn't have what you need.
You should use for example selenium (or requests-html) if you want to parse page with elements rendered by web browser.



from bs4 import BeautifulSoup
from requests_html import HTMLSession
session = HTMLSession()
response = session.get('https://www.google.com/search?hl=en&ei=coGHXPWEIouUr7wPo9ixoAg&q=%EC%9D%BC%EB%B3%B8%20%E6%A1%9C%E5%B7%9D%E5%B8%82%E7%9C%9F%E5%A3%81%E7%94%BA%E5%8F%A4%E5%9F%8E%20%EB%82%B4%EC%9D%BC%20%EB%82%A0%EC%94%A8&oq=%EC%9D%BC%EB%B3%B8%20%E6%A1%9C%E5%B7%9D%E5%B8%82%E7%9C%9F%E5%A3%81%E7%94%BA%E5%8F%A4%E5%9F%8E%20%EB%82%B4%EC%9D%BC%20%EB%82%A0%EC%94%A8&gs_l=psy-ab.3...232674.234409..234575...0.0..0.251.929.0j6j1......0....1..gws-wiz.......35i39.yu0YE6lnCms')
soup = BeautifulSoup(response.content, 'html.parser')

tomorrow_weather = soup.find('span', 'id': 'wob_dc').text
print(tomorrow_weather)


Output:



pawel@pawel-XPS-15-9570:~$ python test.py
Clear with periodic clouds






share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 26 at 8:00

























answered Mar 26 at 7:54









pakopako

3801 silver badge6 bronze badges




3801 silver badge6 bronze badges












  • Thanks a lot! With requests-html, it finally worked!

    – sjk1204
    Mar 26 at 8:05

















  • Thanks a lot! With requests-html, it finally worked!

    – sjk1204
    Mar 26 at 8:05
















Thanks a lot! With requests-html, it finally worked!

– sjk1204
Mar 26 at 8:05





Thanks a lot! With requests-html, it finally worked!

– sjk1204
Mar 26 at 8:05













0














>>> from bs4 import BeautifulSoup
>>> soup = BeautifulSoup(a)
>>> a
'<div id="wob_dcp">n <span class="vk_gy vk_sh" id="wob_dc">Clear with periodic clouds</span> n</div>'
>>> soup.find("span", id="wob_dc").text
'Clear with periodic clouds'


Try this out.






share|improve this answer

























  • Obviously this works, but this is not the answer to the question. He requires it using requests.

    – DirtyBit
    Mar 26 at 7:44











  • If you inspect the response.content of request.get you won't find span in the content. It is because Javascript rendering the HTML and you don't get what you intending.

    – Pravin
    Mar 26 at 7:53
















0














>>> from bs4 import BeautifulSoup
>>> soup = BeautifulSoup(a)
>>> a
'<div id="wob_dcp">n <span class="vk_gy vk_sh" id="wob_dc">Clear with periodic clouds</span> n</div>'
>>> soup.find("span", id="wob_dc").text
'Clear with periodic clouds'


Try this out.






share|improve this answer

























  • Obviously this works, but this is not the answer to the question. He requires it using requests.

    – DirtyBit
    Mar 26 at 7:44











  • If you inspect the response.content of request.get you won't find span in the content. It is because Javascript rendering the HTML and you don't get what you intending.

    – Pravin
    Mar 26 at 7:53














0












0








0







>>> from bs4 import BeautifulSoup
>>> soup = BeautifulSoup(a)
>>> a
'<div id="wob_dcp">n <span class="vk_gy vk_sh" id="wob_dc">Clear with periodic clouds</span> n</div>'
>>> soup.find("span", id="wob_dc").text
'Clear with periodic clouds'


Try this out.






share|improve this answer















>>> from bs4 import BeautifulSoup
>>> soup = BeautifulSoup(a)
>>> a
'<div id="wob_dcp">n <span class="vk_gy vk_sh" id="wob_dc">Clear with periodic clouds</span> n</div>'
>>> soup.find("span", id="wob_dc").text
'Clear with periodic clouds'


Try this out.







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 26 at 7:45

























answered Mar 26 at 7:42









PravinPravin

1771 gold badge4 silver badges19 bronze badges




1771 gold badge4 silver badges19 bronze badges












  • Obviously this works, but this is not the answer to the question. He requires it using requests.

    – DirtyBit
    Mar 26 at 7:44











  • If you inspect the response.content of request.get you won't find span in the content. It is because Javascript rendering the HTML and you don't get what you intending.

    – Pravin
    Mar 26 at 7:53


















  • Obviously this works, but this is not the answer to the question. He requires it using requests.

    – DirtyBit
    Mar 26 at 7:44











  • If you inspect the response.content of request.get you won't find span in the content. It is because Javascript rendering the HTML and you don't get what you intending.

    – Pravin
    Mar 26 at 7:53

















Obviously this works, but this is not the answer to the question. He requires it using requests.

– DirtyBit
Mar 26 at 7:44





Obviously this works, but this is not the answer to the question. He requires it using requests.

– DirtyBit
Mar 26 at 7:44













If you inspect the response.content of request.get you won't find span in the content. It is because Javascript rendering the HTML and you don't get what you intending.

– Pravin
Mar 26 at 7:53






If you inspect the response.content of request.get you won't find span in the content. It is because Javascript rendering the HTML and you don't get what you intending.

– Pravin
Mar 26 at 7:53


















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%2f55351871%2fbeautifulsoup-attributeerror-nonetype-object-has-no-attribute-text%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

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현