Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

os.path equivalent for web urls in python?

Tags:

python

url

path

For joining, splitting and processing file and directory paths python's os.path modul is great. Is there an equivalent for web urls?

like image 943
Aufwind Avatar asked Aug 10 '11 07:08

Aufwind


People also ask

Does Pathlib work with urls?

No. pathlib is for filesystem paths (i.e., paths to files on your computer), while S3 paths are URIs.

What is Python os path?

The os. path module is a very extensively used module that is handy when processing files from different places in the system. It is used for different purposes such as for merging, normalizing and retrieving path names in python .

What is os path in Django?

This is the absolute path of the directory where the program resides which is what you want I believe. os.path.abspath(os.path.dirname(__file__)) This is the parent directory of the program os.path.join(os.path.dirname(__file__), 'some_directory')


1 Answers

urlparse - Parse URLs into components, is the module for you..

To actually fetch urls & data, you need urllib2.

like image 120
Srikar Appalaraju Avatar answered Sep 22 '22 08:09

Srikar Appalaraju