## pytn
With the help of pytn you can use your txt file as a json file in a very simple way
pytn stands for - python text notation
## Dependencies
- filemod `pip install pytn`
### Installation and Usage
1. use `pip install pytn`
2. Make sure that your `pip` version is updated `pip install --upgrade pip`.
3. Import the package: ``import pytn``
# Updates
-edit_data()-> bug fix
### Functions in the module
- First load the data of the file using load_txt method you need to load
data every time you make changes to it as it is using txt as its main source
`load_txt(filename)`
- extract_keys method helps you extract all the keys from the txt file , and returns them all in the list
`extract_keys(data).`
- extract_values method helps you extract all the values from the specific keys in sequence from the txt file , and returns them in the list.
`extract_keys(data).`
- extract_data method helps you extract all the key value pairs from the txt file to dict
`extract_data(filename)`
- edit_data method helps you edit key's value pair , it takes filename ,key, and a value to change.
`edit_data(filename,key,value_to_change)`
- remove_data method helps you remove keys and values pair
`remove_value(filename,key)`
## Run Locally
Clone the project
```bash
git clone https://github.com/kshitij1235/pytn/tree/main/dist
```
Install
```bash
pip install pytn
```
## List of Functions
| functions | processs| args|
| ----------|---------|-----|
|load_txt|loads the txt data|filename|
|extract_keys|extract key from data|filename|
|extract_values|extract values from data|filename|
|extract_data|Extracts key value pair|filename|
|edit_data|Edit certain key values|filename,key,value_to_change|
|add_data|Help add data to the txt| filename,new key , new value|
|remove_data|remove key value pair|filename,key|
## Usage/Examples
### way to write your txt
```txt
{
settings: active is on
values:244
meta:[23,52,53,work]
unit_test=True
}
Rules :
1) Dont make any sub tree to write your data do it under one tree/{}.
2)dont use ] or [ inside arrays.
4)strictly use : or = when assigning values.
```
### code
```python
from pytn import *
###printing basic dictornary
file="main.txt"
print(extract_data(file)) #printing key value pairs
####extracting keys and values separately
print(extract_keys(file)) #printing the updated key values
print(extract_values(file)) #printing the updated values values
```
### Output
```javascript
{'settings': 'active is on', 'values': 244, 'meta': [23, 52, 53, 'work'],'unit_test':True}
['settings', 'values', 'meta','unit_test']
['active is on', 244, [23, 52, 53, 'work'],True]
```
## Badges
[![MIT License](https://img.shields.io/apm/l/atomic-design-ui.svg?)](https://github.com/kshitij1235/pytn/blob/main/LICENSE)
## Authors
- [@kshitij1235](https://github.com/kshitij1235)
- [website](https://sites.google.com/view/pytn)
Raw data
{
"_id": null,
"home_page": "https://github.com/kshitij1235/filemod",
"name": "pytn",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "file",
"author": "kshitij jathar",
"author_email": "kshitijjathar7@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/4c/87/5d6bc86a12dd0b07561e2957f985d7c87d82ab84c38e3b04988d50a09ae0/pytn-1.2.tar.gz",
"platform": null,
"description": "## pytn\r\n\r\n\r\n\r\nWith the help of pytn you can use your txt file as a json file in a very simple way\r\n\r\n\r\n\r\npytn stands for - python text notation\r\n\r\n\r\n\r\n## Dependencies \r\n\r\n\r\n\r\n- filemod `pip install pytn` \r\n\r\n\r\n\r\n### Installation and Usage\r\n\r\n\r\n\r\n1. use `pip install pytn`\r\n\r\n2. Make sure that your `pip` version is updated `pip install --upgrade pip`. \r\n\r\n3. Import the package: ``import pytn``\r\n\r\n\r\n\r\n# Updates\r\n\r\n\r\n\r\n-edit_data()-> bug fix\r\n\r\n\r\n\r\n### Functions in the module \r\n\r\n\r\n\r\n- First load the data of the file using load_txt method you need to load \r\n\r\ndata every time you make changes to it as it is using txt as its main source\r\n\r\n`load_txt(filename)`\r\n\r\n\r\n\r\n- extract_keys method helps you extract all the keys from the txt file , and returns them all in the list\r\n\r\n`extract_keys(data).`\r\n\r\n\r\n\r\n- extract_values method helps you extract all the values from the specific keys in sequence from the txt file , and returns them in the list.\r\n\r\n`extract_keys(data).`\r\n\r\n\r\n\r\n- extract_data method helps you extract all the key value pairs from the txt file to dict\r\n\r\n`extract_data(filename)`\r\n\r\n\r\n\r\n- edit_data method helps you edit key's value pair , it takes filename ,key, and a value to change.\r\n\r\n`edit_data(filename,key,value_to_change)` \r\n\r\n\r\n\r\n- remove_data method helps you remove keys and values pair \r\n\r\n`remove_value(filename,key)` \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n## Run Locally\r\n\r\n\r\n\r\nClone the project\r\n\r\n\r\n\r\n```bash\r\n\r\n git clone https://github.com/kshitij1235/pytn/tree/main/dist\r\n\r\n```\r\n\r\n\r\n\r\nInstall\r\n\r\n\r\n\r\n```bash\r\n\r\n pip install pytn\r\n\r\n```\r\n\r\n\r\n\r\n## List of Functions\r\n\r\n\r\n\r\n| functions | processs| args|\r\n\r\n| ----------|---------|-----|\r\n\r\n|load_txt|loads the txt data|filename|\r\n\r\n|extract_keys|extract key from data|filename|\r\n\r\n|extract_values|extract values from data|filename|\r\n\r\n|extract_data|Extracts key value pair|filename|\r\n\r\n|edit_data|Edit certain key values|filename,key,value_to_change|\r\n\r\n|add_data|Help add data to the txt| filename,new key , new value|\r\n\r\n|remove_data|remove key value pair|filename,key|\r\n\r\n\r\n\r\n## Usage/Examples\r\n\r\n\r\n\r\n### way to write your txt\r\n\r\n\r\n\r\n```txt\r\n\r\n{\r\n\r\nsettings: active is on\r\n\r\nvalues:244\r\n\r\nmeta:[23,52,53,work]\r\n\r\nunit_test=True\r\n\r\n}\r\n\r\n\r\n\r\nRules : \r\n\r\n1) Dont make any sub tree to write your data do it under one tree/{}.\r\n\r\n2)dont use ] or [ inside arrays.\r\n\r\n4)strictly use : or = when assigning values.\r\n\r\n```\r\n\r\n\r\n\r\n### code\r\n\r\n\r\n\r\n```python\r\n\r\nfrom pytn import *\r\n\r\n\r\n\r\n###printing basic dictornary \r\n\r\nfile=\"main.txt\"\r\n\r\nprint(extract_data(file)) #printing key value pairs\r\n\r\n\r\n\r\n\r\n\r\n####extracting keys and values separately\r\n\r\nprint(extract_keys(file)) #printing the updated key values\r\n\r\nprint(extract_values(file)) #printing the updated values values\r\n\r\n\r\n\r\n```\r\n\r\n\r\n\r\n\r\n\r\n### Output\r\n\r\n\r\n\r\n```javascript\r\n\r\n\r\n\r\n{'settings': 'active is on', 'values': 244, 'meta': [23, 52, 53, 'work'],'unit_test':True}\r\n\r\n['settings', 'values', 'meta','unit_test']\r\n\r\n['active is on', 244, [23, 52, 53, 'work'],True]\r\n\r\n```\r\n\r\n\r\n\r\n## Badges\r\n\r\n\r\n\r\n\r\n\r\n[![MIT License](https://img.shields.io/apm/l/atomic-design-ui.svg?)](https://github.com/kshitij1235/pytn/blob/main/LICENSE)\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n\r\n## Authors\r\n\r\n\r\n\r\n- [@kshitij1235](https://github.com/kshitij1235)\r\n\r\n- [website](https://sites.google.com/view/pytn)\r\n\r\n\r\n\r\n \r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python text notation",
"version": "1.2",
"project_urls": {
"Bug Tracker": "https://github.com/kshitij1235/filemod/issues",
"Homepage": "https://github.com/kshitij1235/filemod"
},
"split_keywords": [
"file"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d776fa095170e617ed94e394b9671dec7b5968c262d7415dd2240087a7d4390f",
"md5": "277d80ae3afa7be0f53a96e768aa2a79",
"sha256": "172cc121c09d2844f2cf07260100c84d5abae70ecf9659cceac5e976a2da9dde"
},
"downloads": -1,
"filename": "pytn-1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "277d80ae3afa7be0f53a96e768aa2a79",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 17716,
"upload_time": "2023-06-26T18:38:47",
"upload_time_iso_8601": "2023-06-26T18:38:47.023950Z",
"url": "https://files.pythonhosted.org/packages/d7/76/fa095170e617ed94e394b9671dec7b5968c262d7415dd2240087a7d4390f/pytn-1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4c875d6bc86a12dd0b07561e2957f985d7c87d82ab84c38e3b04988d50a09ae0",
"md5": "f5688ade48fee464101514f2babbdc2e",
"sha256": "3192cbde54542ac3e475cd5a15fd47e5c0eb7d4bfe7b730d711b633de3fe827c"
},
"downloads": -1,
"filename": "pytn-1.2.tar.gz",
"has_sig": false,
"md5_digest": "f5688ade48fee464101514f2babbdc2e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 17055,
"upload_time": "2023-06-26T18:38:49",
"upload_time_iso_8601": "2023-06-26T18:38:49.547298Z",
"url": "https://files.pythonhosted.org/packages/4c/87/5d6bc86a12dd0b07561e2957f985d7c87d82ab84c38e3b04988d50a09ae0/pytn-1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-26 18:38:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kshitij1235",
"github_project": "filemod",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pytn"
}