Qalm is a way to handle Files IO in One-Line
Project description
Qalm
Qalm is a way to handle Files IO in One-Line
We deal with files all the time
& most of time handling files makes our
code NOT-DRY, with Qalm you can read/write & more in One-Line
also Qalm handles JSON Files in special way
Usage :
Install :
pip install Qalm
import :
from Qalm import pen_head , json_pen
Normal files IO
Read
file_content = pen_head(Path = "Helloworld.txt" , Mode = 'r')
file_content = pen_head("Helloworld.txt" , 'r')
print(file_content)
Write
x = "Hello World"
qalm.pen_head(Path = "Helloworld.txt" , Mode = 'w', Content = x)
qalm.pen_head("Helloworld.txt" ,'w', x)
Append
x = "Hello World"
qalm.pen_head(Path = "Helloworld.txt" , Mode = 'a', Content = x)
qalm.pen_head("Helloworld.txt" ,'a', x)
You also can set a file stat
pen_head(Path = test.txt , Mode = 'w' , Content = 'test', stat = [True , "+h +r +s"])
Get a file lines as an iterator
x = pen_head('foo.txt' , "rl")
JSON files IO :
Read from a JSON file
x = json_pen("test.json","r")
Write to a JSON file
jd = {"foo" : "boo","foo2":"boo2"}
x = json_pen('foo.json' , "w" , jd)
append to a file
tag = {"foo":'boo',
"boo2": [ "boo", "foo" ],
"boo3": [ "boo1", "foo2" ]}
#Mother is the Name of the Mother list inside the JSON File
json_pen(Path ="foo.json", Mode ="a" , Content = tag, Mother ="foo0")
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
Qalm-0.0.1.tar.gz
(2.3 kB
view details)
Built Distribution
Qalm-0.0.1-py3-none-any.whl
(2.7 kB
view details)
File details
Details for the file Qalm-0.0.1.tar.gz
.
File metadata
- Download URL: Qalm-0.0.1.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 129943ac6516a8a56e705662538e817ef0cb93c999160a8ab5c326c7d8cc17cd |
|
MD5 | 05b8bdcaeab314795741b8cec105eb93 |
|
BLAKE2b-256 | 9ceec7146a1ccbbe5b51da05bc1b76702e3559acfd8cdbb747d8070e94c68611 |
File details
Details for the file Qalm-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: Qalm-0.0.1-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80a7be57360b62ceb662e12f2eb24c6dce9b4d10813eacab6ee1863842fcf168 |
|
MD5 | 5a1f3ca35bb062606cf0176f5f311c0e |
|
BLAKE2b-256 | 83fd1d2c976a52995e11e9f503d5edd14d825be562feb9eb02dc1ebce264ad11 |