Provides functionality for creating a new empty file with unique name
Project description
FileCreate
Provides functionality for creating a new empty file with unique name.
The file_mask parameter may contain a sequence of hash marks '#' which will be substituted by a unique sequence number starting from 001.
Install:
$ pip install filecreate
Usage Samples:
from filecreate import FileCreate
# Create file using mask
# by default parameter leading_zeros=True and all hash signs are replaced with numbers
with FileCreate('test####.txt') as file: # if test0001.txt does not exist - creates it
file.writelines() # working with file descriptor as usual
with FileCreate('test####.txt', leading_zeros=False): # will create file test1.txt
file.writelines()
# if file cannot be created (maximum sequence reached) - FileExistsError exception is raised
# Get available file name without creating an actual file
filename = FileCreate.get_filename('Folder', 'test###.txt')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
filecreate-0.0.7.tar.gz
(3.8 kB
view hashes)
Built Distribution
Close
Hashes for filecreate-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9197c77874339ab70f249750c35a245de112f257017542458080a6acd2597151 |
|
MD5 | 785a00d8de1eb99a2faf3bdd6528ce52 |
|
BLAKE2b-256 | 49f3f495eb72355636604961472326d25dc0c03d21ce4fc219bbd2930eb71b65 |