Skip to main content

Easytexts: Simplified text management for quick and simple projects

Project description

Easytexts: A Simple File Handler for Python

Install Easytexts using pip:

pip install Easytexts

Usage:

Import the easytexts module:

from Easytexts.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, only if a file with the same name doesnt already exist, 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Easytexts-1.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

Easytexts-1.1.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file Easytexts-1.1.0.tar.gz.

File metadata

  • Download URL: Easytexts-1.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for Easytexts-1.1.0.tar.gz
Algorithm Hash digest
SHA256 355e09e361ef41f873602b72bcd0d57de4391143a83968352aec27e97d0a743f
MD5 a42a01ba1a0162a25bd55d77acba9fa1
BLAKE2b-256 899dc003efc572aac72cbeab817917e93a1f4830c7312b4f7e9c6531476e1767

See more details on using hashes here.

File details

Details for the file Easytexts-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: Easytexts-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for Easytexts-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bbea952499b996b8ed126ffac964e2eafba4eb647c3f7f810f618c75d77c86bd
MD5 d6eb7023740f4b06319364598636e964
BLAKE2b-256 b03e6034292f7cbfdf35283dba862706ebfe3bb78e7bccc7fd1367ff95878270

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page