I have to store some temporary files (it does not have to be human-readable). Since I'm creating them from different threads, I don't want to do difficult communication between threads - which name is reserved or already used etc.
The best option seems to be using hash
.
Example:
I have many records under the block 'Žilina', '54845'. I want to store them temporary into some txt file.
So I would do this:
write_into_temp_file(name_of_the_file=hashlib.file_name_hash('Žilina54845'))
And I can be sure (99.9999 %) that there won't be any collision with another temporary file.
I've tried to find some inspiration in this question Short Python alphanumeric hash with minimal collisions but those hashes
contains signs which are not allowed to be a part of the file name. For example ==
EDIT:
My OS is Windows