An easy to use interface for basic file handling operations.
Project description
simple_file_handler
The FileHandler class provides an interface to perform most file operations easily and intuitively. All you need is the file path.
import simple_file_handler as sfh
# Use in a with statement to ensure the file is closed after use
with sfh.FileHandler('path/to/file.txt') as hdl:
try:
# Read the handled file's content
data = hdl.read_file(mode='r')
# Write to the handled file
hdl.write_file(b'Hello World!', mode='ab')
# Make a copy of the handled file
copy_hdl = hdl.make_copy('path/to/directory', filename='file_copy')
print(copy_hdl.file_path)
# Delete the handled file
hdl.delete_file()
except sfh.FileError as exc:
print(exc)
Installation
Do a pip install from the command line:
pip install simple-file-handler
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
simple_file_handler-0.0.1.tar.gz
(22.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simple_file_handler-0.0.1.tar.gz.
File metadata
- Download URL: simple_file_handler-0.0.1.tar.gz
- Upload date:
- Size: 22.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04d8732c141040d15768644767cceb8fad87b5114a9ca86e89a4fc3204cb522b
|
|
| MD5 |
6b044d4dfd53311165aa1229c1c33336
|
|
| BLAKE2b-256 |
36bca43a5b1dc99a386b4458a0228d178da287b71e31107beeb8069568881a70
|
File details
Details for the file simple_file_handler-0.0.1-py3-none-any.whl.
File metadata
- Download URL: simple_file_handler-0.0.1-py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9776555352fd62aa3de14959ef179a9e610b9fb194e682a5a033fa3e93eaeab0
|
|
| MD5 |
765525d50c59d9bcaf528d3f66db8cfd
|
|
| BLAKE2b-256 |
cab77eb0142c29fd07b3ee87150b587386d576bafa46da858945846f9a4b4058
|