Python 3.9 is now generally available.


Determines if a file name is valid.

filename The file name to validate. The file name must be a valid file name:

- It must only contain letters, numbers, and the following special
  characters:  `@`, `_`, `+`, `/` `$`, `.`, `-`, or '~'.
- It must be less than 256 characters.
- It must not contain `/./`, `/../`, or `//`.
- It must not end in `/`.
- All spaces must be in the middle of a directory or file name.

An error string if the file name is invalid. '' is returned if the file name is valid.