Usage/Examples

way to write your txt


settings: active

values:244

meta:[23,52,53,work]

unit_test:True


Rules :

1) Don't make any sub tree to write your data do it under one tree/{}.

2)don't use ] or [ inside arrays.

4)strictly use : and = when assigning values.


code

import json_txt


###printing basic dictornary

file=json_txt.load_txt("main.txt") #load the txt file

print(json_txt.extract_data(file)) #printing key value pairs



####extracting keys and values separately

print(json_txt.extract_keys(file)) #printing the updated key values

print(json_txt.extract_values(file)) #printing the updated values values


Output

✠Test 1 pass

✠Test 2 pass

✠Test 3 pass

All Test Passed

{'settings': 'active', 'values': 244, 'meta': [23, 52, 53, 'work'],'unit_test':True}

['settings', 'values', 'meta','unit_test']

['active', 244, [23, 52, 53, 'work'],True]