Python Forum
How to convert Python crawled Bing web page content to human readable?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to convert Python crawled Bing web page content to human readable?
#5
(Sep-02-2018, 02:24 PM)metulburr Wrote: I dont even get that with your code. I get html code if i change your respage variable to res. Where do you define ResPage? As you only define res.

Anyways the more common approach now is to use the requests module.

import requests
 
r = requests.get('http://www.bing.com')
print(r.text)
print(r.headers['content-type'])

Thanks a lot!
Sorry for the confusion about the variable names, I meant to use the 'res' all the way.
Seems I need to abandon the old school way of doing the http things...
I just have one more question: should I regard Requests as a total replacement for the old urllib things? Would you mind give some sayings about this?

Regards
Reply


Messages In This Thread
RE: How to convert Python crawled Bing web page content to human readable? - by dalaludidu - Sep-02-2018, 04:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Storing data in readable place user_404_lost_and_found 4 1,382 Jul-22-2024, 06:14 AM
Last Post: Pedroski55
  io.UnsupportedOperation: not readable RedSkeleton007 2 21,416 Nov-06-2023, 06:32 AM
Last Post: gpurdy
  Python SSL web page scraping Vadanane 1 1,842 Jan-13-2023, 04:11 PM
Last Post: snippsat
  Human Sorting (natsort) does not work [SOLVED] AlphaInc 2 2,056 Jul-04-2022, 10:21 AM
Last Post: AlphaInc
  How to make x-axis readable with matplotlib Mark17 7 6,743 Mar-01-2022, 04:30 PM
Last Post: DPaul
  Function global not readable by 'main' fmr300 1 2,070 Jan-16-2022, 01:18 AM
Last Post: deanhystad
  sorting alphanumeric values in a human way idiotonboarding 3 3,881 Jan-22-2021, 05:57 PM
Last Post: idiotonboarding
  io.UnsupportedOperation: not readable navidmo 1 4,379 Oct-31-2019, 11:04 PM
Last Post: ichabod801
  Display output in readable format and save hnkrish 1 3,377 Jul-19-2019, 09:29 AM
Last Post: Larz60+
  Batch job from epoch to human time jheeman 6 5,721 Feb-27-2018, 10:53 PM
Last Post: jheeman

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020