Easytexts: Simplified text management for quick projects
Project description
Easytexts: A Simple File Handler for Python
Install Easytexts using pip:
pip install Easytexts
Usage:
Import the easytexts module:
from Easytexts import *
Writing and Appending:
append(file, text, newline=True, log=False): Appends text to a file, optionally adding a newline and logging the action. Example:
append(“my_file.txt”, “This is a new line.”) # Optional: Log the action append(“my_file.txt”, “Another line!”, log=True)
clear(file, text, replacement, log=False): Overwrites the entire content of a file with new text (replacement), optionally logging the action. Example:
clear(“my_file.txt”, “This is the new content.n”)
cide(file, text, log=False): Creates a new file and writes text to it, handling existing files gracefully, optionally logging the action. Example:
cide(“new_file.txt”, “Hello, world!n”)
Reading:
read(file, log=False): Reads the entire content of a file and returns it as a string, optionally logging the action. Example:
content = read(“my_file.txt”) print(content)
Checking:
is_empty(file, log=False): Checks if a file is empty, returning True if empty, False otherwise, optionally logging the result. Example:
- if is_empty(“my_file.txt”):
print(“The file is empty.”)
Deleting:
delete(file, log=False): Deletes a file. Example:
delete(“my_file.txt”)
Checking Existence:
does_exist(file, log=False): Checks if a file exists, returning True if exists, False otherwise. Example:
- if does_exist(“my_file.txt”):
print(“The file exists.”)
Disclaimer
While Easytext handles common errors and is suitable for learning and small projects, it’s not intended for critical or demanding projects due to its limited scope and testing.
Additional Notes
The log parameter allows you to control if certain actions are logged (printed) for debugging or tracking purposes. The newline parameter in append allows you to control whether a newline character is added before the appended text.
if you find any errors please let me know by making a poll on the github page ☺
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
Built Distribution
File details
Details for the file Easytexts-0.5.0.tar.gz
.
File metadata
- Download URL: Easytexts-0.5.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b199d2615a5b06189275d27b3e625f3b18eab8a3c4ee999cab3e976d4f7ae4ff |
|
MD5 | c34c71b79565b7ad9a46249ecb89f7e6 |
|
BLAKE2b-256 | 0fec87474625d620307d0185d717ed5d6ae11de9c0160473b0f5edb9a31c2036 |
File details
Details for the file Easytexts-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: Easytexts-0.5.0-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6752e4a95a8f0cb33b3f4a986f62e4f41c334e985a57f912e1217f211e3fce9b |
|
MD5 | 9ca2063911ce65dbf672c965a35a3ce0 |
|
BLAKE2b-256 | 9c7fdaf111eb137d85bb95143b4e66998d4bd42483f49f65d2663fdd06e788ae |