File and JSON File Methods.
Project description
File Tools
Includes useful methods for file/json file reading and writing.
Install
python3 -m pip install file-tools
Usage
from file_tools.file import get_file_string, get_file_lines
from file_tools.json_file import import_json, export_json
my_text = get_file_string('text.txt')
my_lines = get_file_lines('text.txt')
my_dict = import_json('example.json')
my_dict['test'] = 1
export_json(data=my_dict, file='example.json')
Methods
- file
- get_file_string
- returns string from file
- Args
- file (string)
- get_file_lines
- returns list of lines from file
- Args
- file (string)
- get_file_string
- json_file
- import_json
- returns dict object (or list) from file
- Args
- file (string)
- export_json
- exports dict object (or list) to file
- Args
- data (dict or list)
- file (string)
- indent (int) - number of spaces for json file indentation
- import_json
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
file-tools-0.0.2.tar.gz
(2.0 kB
view hashes)
Built Distribution
Close
Hashes for file_tools-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24e0129f0b2ced39527d33c4e1818f22f332dc7fba29b940cf1e20c00453f142 |
|
MD5 | 522c83d5e7fc1abce37997a7c2814c4b |
|
BLAKE2b-256 | 32a723d342b778ca5f9151b68c2c42ab2785f23abaf2ee6f7000deaf37327a3d |