Skip to main content

Makes a string file path compatible (Windows)

Project description

Makes a string file path compatible (Windows)

# Tested with:
# Python 3.9.13
# Windows 10


$pip install windows-filepath



import sys
import pandas as pd
import inspect 
from windows_filepath import make_filepath_windows_comp, allow_long_path_windows
# creating some random data 
teststuff = [x + '.png' if ini % 2 == 0 else x for ini, x in enumerate(inspect.getsource(pd).splitlines())]
for _ in teststuff:
    # doesn't check the length, you can change the windows settings by calling allow_long_path_windows()
    # This will set the MAX_PATH to 32,767
    fp = make_filepath_windows_comp(
    filepath=_,
    fillvalue="_", # replacement of any illegal char
    reduce_fillvalue=True, # */<> (illegal chars) -> ____ (replacement) -> _ (reduced replacement)
    remove_backslash_and_col=False, # important for multiple folders
    spaceforbidden=True, # '\s' -> _ 
    other_to_replace=(";", ",", "[", "]", "`", "="), # other chars you don't want in the file path
    slash_to_backslash=True, # replaces / with \\ before doing all the other replacements 
)
    print(_)
    print(fp, end='\n\n')


	

Project details


Release history Release notifications | RSS feed

This version

0.10

Download files

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

Source Distribution

windows_filepath-0.10.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

windows_filepath-0.10-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file windows_filepath-0.10.tar.gz.

File metadata

  • Download URL: windows_filepath-0.10.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for windows_filepath-0.10.tar.gz
Algorithm Hash digest
SHA256 aeb19549eacc9b93bb8f43865544e887c9bf58d976a72174e06217f0814250bc
MD5 df62bd4aed412602a115cc27da506bc7
BLAKE2b-256 8e0009abfe7bc94963c842a39cb098f95daa27072f79c27c4987fc9d2ed2bd56

See more details on using hashes here.

File details

Details for the file windows_filepath-0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for windows_filepath-0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 ae1a9e640ecaee1fad9e6b7e82c1a251cf9809e0243d21e973a2cc883702fc3e
MD5 1e8f253eef86fe74731b34fc46801b6c
BLAKE2b-256 ca34b445d7c4343ad6d9b04d4e66ae73916d444f948c8cffd67fd43fcfab06bd

See more details on using hashes here.

Supported by

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