Как создать имя файла с точкой в ​​конце в Windows?

Как в Python работать с именами файлов, которые заканчиваются точкой? Согласно сайту MSDN, такие имена файлов допустимы в Windows, но всякий раз, когда я пытаюсь создать их в Python, последняя точка удаляется. Я даже пытался создать необработанный дескриптор файла с помощью os.open, но он все равно удаляет точку.

Например, это создаст файл с простым именем «test»

os.open('test.', os.O_CREAT | os.O_WRONLY, 0777)

. Изменить:Вот точная цитата

About spaces and dots in filenames and directories. The limits are in the windows shell -- not in Windows or NT. Using 'bash', you can create files with spaces (or dots), both, at the beginning and end of a filename. You can then list and open those files in explorer, and you can 'list' them in the shell (cmd.exe), but you won't necessarily be able to open them from the shell (especially trailing spaces and dots).

8
задан anatoly techtonik 6 September 2014 в 13:22
поделиться