For joining, splitting and processing file and directory paths python's os.path
modul is great. Is there an equivalent for web urls?
No. pathlib is for filesystem paths (i.e., paths to files on your computer), while S3 paths are URIs.
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 .
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')
urlparse - Parse URLs into components, is the module for you..
To actually fetch urls & data, you need urllib2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With