Simple Python package for text file operations.
Project description
TXTFile
Simple Python package for text file operations.
Install
pip install wixok.txtfile
Usage
from wixok.txtfile import TXTFile
# Read entire file content as a string
content = TXTFile.load("data.txt")
print(content) # 'line 1\nline 2\nline 3\nline 4\n'
# Read file lines into a list
lines = TXTFile.load_lines("data.txt")
print(lines) # ['line 1', 'line 2', 'line 3', 'line 4']
# Add a line to the file
success = TXTFile.add_line("data.txt", "line 5")
print(success) # True
# Clear file contents
cleared = TXTFile.clear("data.txt")
print(cleared) # True
Methods
| Method | Description | Returns |
|---|---|---|
load(path) |
Read entire file content as a single string | str |
load_lines(path) |
Read file lines into a list of strings | list[str] |
add_line(path, text) |
Append a line to the file (with newline) | bool |
clear(path) |
Empty the file | bool |
Debug Mode
TXTFile.debug = True # Enable error messages
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
wixok_txtfile-25.8.3.tar.gz
(4.7 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 wixok_txtfile-25.8.3.tar.gz.
File metadata
- Download URL: wixok_txtfile-25.8.3.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e47681b27687024be8e298a4f3fbef62b077a4af4220759360a77f6621503e51
|
|
| MD5 |
4e3205662bcf8b83113c84b152df19bf
|
|
| BLAKE2b-256 |
1d22c5b5876840ac4b23779fd9a3f356d7bb100850e53583460db2219440f839
|
File details
Details for the file wixok_txtfile-25.8.3-py3-none-any.whl.
File metadata
- Download URL: wixok_txtfile-25.8.3-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
feb9cf4032983394f0db5423c835918886d80fe25d7d7f6fdf3588c75c5bf23d
|
|
| MD5 |
b84c83255d6a99a05d9d949947f89f54
|
|
| BLAKE2b-256 |
844437cfe5a24d3778a74691569d951ba0f8e4e896ba4767178304be528ca20c
|