How to create a filename with a trailing period in Windows?

Viewed 6355

How does one work with filenames that end in a period in Python? According to MSDN's site, such filenames are valid in Windows, but whenever I try to create one in Python, it removes the final period. I even tried creating a raw file descriptor with os.open, but it still removes the period.

For example, this will create a file simply named 'test'

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

Edit: Here is the exact quote

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).

3 Answers
Related