Skip to main content

Best Practices for Handling Paths in Windows.

Project description

windows_pathlib

Best Practices for Handling Paths in Windows.

Have you written code like this?

import os
import pathlib as Path

# In Windows, the desktop can be changed to any location. The desktop is not necessarily located in the home directory.
print(Path(os.path.expanduser("~/Desktop")))

# This does not work.
print(Path("%APPDATA%/Microsoft"))

windows_pathlib can be used for concise writing.

from windows_pathlib import WindowsPathlib as Path

# C:\Users\username\Desktop
print(Path.desktop())

# C:\Users\username\AppData\Roaming\Microsoft
print(Path("%APPDATA%/Microsoft"))

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

windows_pathlib-0.0.1.tar.gz (2.5 kB view hashes)

Uploaded Source

Built Distribution

windows_pathlib-0.0.1-py3-none-any.whl (2.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page