Easy and light manager for basic text data.
TxtData is a Python library designed for basic handling of data in .txt files. This lightweight library, with less than 400 lines of code, offers an easy-to-use API and includes comprehensive, well-written tests.
- Simple and intuitive handling of .txt data.
- Lightweight design for efficient performance.
- Extensive testing ensuring reliability.
Installation
pip install txtdata
Examples
from txtdata import TxtData
# Creating an empty TxtData instance
txt = TxtData()
print(txt.empty) # Output: True
# Creating with a simple dictionary.
txt = TxtData({'A': [1,2,3], 'B': ['x','y','z']})
print(txt)
# Output: [{'A': 1, 'B': 'x'}, {'A': 2, 'B': 'y'}, {'A': 3, 'B': 'z'}]
# Inserting data
txt = TxtData()
txt.insert({'A': 123, 'B': 'zzz'}) # single data by single dict
txt.insert(A=182, C='asdf') # single data by keyword
txt.insert([{'A': None}, {'B': 'zzz', 'C': 'yes'}]) # multiple data by list of dicts
txt.insert({'A': [1, 3], 'B': ['yyy', 'www']}) # multiple data by dict of lists
print(txt)
# Output: [
# {'A': 123, 'B': 'zzz', 'C': None},
# {'A': 182, 'B': None, 'C': 'asdf'},
# {'A': None, 'B': None, 'C': None},
# {'A': None, 'B': 'zzz', 'C': 'yes'},
# {'A': 1, 'B': 'yyy', 'C': None},
# {'A': 3, 'B': 'www', 'C': None}
# ]
# Filtering data
filtered_txt = txt.filter(A=182)
print(len(filtered_txt)) # Output: 1 (based on data above)
# Delete
txt.delete(B=None) # Deletes all data with B equals to None
# Saving
txt.save('data.txt', delimiter=';')
# txt file:
# A;B;C
# 123;zzz;
# 182;;asdf
# ;;
# ;zzz;yes
# 1;yyy;
# 3;www;
Metadata
Release files for txtdata 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| txtdata-0.1.2.tar.gz | 5.1 kB | Without provenance | Details for txtdata-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| txtdata-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for txtdata-0.1.2-py3-none-any.whl |
Total release size: 10.6 kB
Release files / txtdata-0.1.2.tar.gz
| Download URL | txtdata-0.1.2.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3329c46232b490d840a69a02b3ca208f36f2f1709a8548a79291de2d3be81c29
|
|
BLAKE2b-256 checksum How to use checksums |
a529f9eca4f82043917fb328956ead1fd2f9b40deff95da6dfee49c0a9cf0ac7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.3 Windows/10
|
Release files / txtdata-0.1.2-py3-none-any.whl
| Download URL | txtdata-0.1.2-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b7160cfe8c732e6f428e4583cf491161056853b23c58add830eb472d2b7dc778
|
|
BLAKE2b-256 checksum How to use checksums |
7c80fc4e39bc5fbaea54fb7d17a65a0348afbbe88610ce9b46a2ca7001611710
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.3 Windows/10
|
Security for txtdata 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.