Skip to main content

Pathing Library

Project description

getpath

Helps with pathing in python scripts. Inspired by pathlib.

IMPORTING

from getpaths import getpath

USING CURRENT FILE PATH

current_dir = getpath() # current file's path

USER-SPECIFIED PATH

custom_dir = getpath('a','b',custom=True)
print(custom_dir)
# /a/b

ADD FILES

custom_dir/'example.txt'
# /a/b/example.txt

custom_dir.add('/a/example.txt')
# /a/b/example.txt

GO UP THE DIRECTORY

custom_dir = getpath('a','b',custom=True)

custom_dir/'..'
# /a

custom_dir.add('..')
# /a

custom_dir.up(1)
# /a

LIST EXISTING FILES AND FOLDERS

custom_dir.ls()
# /a/b/example.txt
# throws error if path does not exist

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

getpaths-1.0.0.tar.gz (4.5 kB view hashes)

Uploaded source

Built Distribution

getpaths-1.0.0-py3-none-any.whl (4.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page