M
Maciej Sobczak
Hi,
I have a string.
This string is to be used as a path for a new file.
I would like to check if this string *could be* a valid file name,
*before* I try to create the file itself.
In other words, I would like to know whether some string violates the
underlying OS's policies (or maybe some more restriced policies, but
portable) considering file paths.
Example:
1.
s = 'C:\file.txt'
the above is potentially a valid path on my system.
2.
s = 'cc:/^- =#jk\kj+.+?! '
the above is rather invalid and I would like to check it somehow before
I even try to create the file.
Does the Python library contain a functionality that allows to achieve
this goal?
I have a string.
This string is to be used as a path for a new file.
I would like to check if this string *could be* a valid file name,
*before* I try to create the file itself.
In other words, I would like to know whether some string violates the
underlying OS's policies (or maybe some more restriced policies, but
portable) considering file paths.
Example:
1.
s = 'C:\file.txt'
the above is potentially a valid path on my system.
2.
s = 'cc:/^- =#jk\kj+.+?! '
the above is rather invalid and I would like to check it somehow before
I even try to create the file.
Does the Python library contain a functionality that allows to achieve
this goal?