Python Forum
urlib - to use or not to use ( for web scraping )?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
urlib - to use or not to use ( for web scraping )?
#42
(Dec-12-2018, 11:09 PM)Truman Wrote: If I understand well os.path.basename is used to get the original name of the image, we can do without it,
Yes it was just to show that option.
A tips get used to test stuff out interactive bye taking parts of code out,a better REPL like IPython or ptpython(what i use) also help.
>>> import os
>>> 
>>> image_location = 'http://www.pythonscraping.com/sites/default/files/lrg_0.jpg'
>>> os.path.basename(image_location)
'lrg_0.jpg'
>>> 
>>> help(os.path.basename)
Help on function basename in module ntpath:

basename(p)
    Returns the final component of a pathname
Reply


Messages In This Thread
RE: urlib - to use or not to use ( for web scraping )? - by snippsat - Dec-13-2018, 03:54 AM

Forum Jump:

User Panel Messages

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