encode short string as filename (unix/windows)
steve at REMOVETHIScyber.com.au
Mon Mar 27 18:47:28 CEST 2006
On Mon, 27 Mar 2006 08:14:07 -0800, nikie wrote:
>> want to encode/decode an arbitrary short 8-bit string as save filename.
>> is there a good already builtin encoding to do this (without too much
>> inflation) ? or re.sub expression?
>> or which characters are not allowed in filenames on typical OS?
> On Windows, / \ : * ? " < > | are forbidden, and the name can't be
Windows also has a number of "reserved names" that you can't use. However,
in general, it is best to ignore that and just let Windows raise an error
if it chooses. But for completeness, here is the the canonical list of
prohibited file names and characters for Windows:
More information about the Python-list