# Tested with:# Python 3.9.13# Windows 10
$pipinstallwindows-filepathimportsysimportpandasaspdimportinspectfromwindows_filepathimportmake_filepath_windows_comp, allow_long_path_windows# creating some random data teststuff= [x+'.png'ifini%2==0elsexforini, xinenumerate(inspect.getsource(pd).splitlines())]
for_inteststuff:
# 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,767fp=make_filepath_windows_comp(
filepath=_,
fillvalue="_", # replacement of any illegal charreduce_fillvalue=True, # */<> (illegal chars) -> ____ (replacement) -> _ (reduced replacement)remove_backslash_and_col=False, # important for multiple foldersspaceforbidden=True, # '\s' -> _ other_to_replace=(";", ",", "[", "]", "`", "="), # other chars you don't want in the file pathslash_to_backslash=True, # replaces / with \\ before doing all the other replacements
)
print(_)
print(fp, end='\n\n')
The Tidelift Subscription provides access to a continuously curated stream of human-researched and maintainer-verified data on open source packages and their licenses, releases, vulnerabilities, and development practices.