0

I am new to Python and try to grab the table from a shtml page. When I used requests.get(url), the result was only a part of the full source code I could see from Chrome Browser and "hq_table" was not in it.

This is the code:

import requests
url = "http://www.xinfadi.com.cn/marketanalysis/2/list/1.shtml"
page_content = requests.get(url)
print(page_content.text)

Although it is short, I am still stuck here. Can anyone give me a hint? Thank you in advance.

funie200
3,9555 gold badges25 silver badges38 bronze badges
asked Dec 1, 2020 at 9:33
3
  • 3
    When I run the code I seem to get the whole page. What part do you want that you don't get from the request? Commented Dec 1, 2020 at 9:38
  • 2
    Yep, works fine for me: >>> 'hq_table' in requests.get("http://www.xinfadi.com.cn/marketanalysis/2/list/1.shtml").text >>> True Commented Dec 1, 2020 at 9:40
  • Fixed. I ran it in Visual Code and it did not print out the full page content. Now I've got it. Thank you, funie200 and AKX Commented Dec 1, 2020 at 10:24

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.