Easy use for fetch data from kinds of files
Project description
filez
Easy use for fetch data from kinds of files
Feature
- Support load txt,csv,excel,conf/ini,json,yaml file to list or dict
- Strip lines for txt
- Ensure_number and ensure_boolean for csv or conf
- Load all sheets or given sheets of excel file
- HTML/XML to Dict
Install
pip install filez
Simple Use
from filez import file
data = file.load('tests/data.txt')
data = file.load('tests/with_header.csv', header=True)
data = file.load('tests/data.xlsx', header=True)
data = file.load('tests/data.conf')
data = file.load('tests/data.json')
data = file.load('tests/data.yaml')
data = file.load('tests/data.html')
data = file.load('tests/xml.html')
File type data type mapping
- txt: [line1, line2, line3] # strip() for each line
- csv:
- no header: [[...], [...], [...]] # ensure_number and ensure_boolean
- with header: [OrderedDict([...]), OrderedDict([...]), OrderedDict([...])]
- json/yaml: [...] or {...}
- conf/ini: {section: {option1: value, option2: value, ...}, section2: {...}}
- excel:
- default:
- no header: [[...], [...], [...]] # ensure_number and ensure_boolean
- with header: [OrderedDict([...]), OrderedDict([...]), OrderedDict([...])]
- given sheets: {Sheet1: [], Sheet2: [],...}
- default:
- html/xml: {'tag': html, 'attrs': {}, 'text': '', children: [{'tag': 'head',...},{'tag': 'body',...}]}
Todo
- load_xmind
- load_doc
- load_pdf
- all2json
- all2yaml
- all2all
- find
- change file and set value
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
filez-0.13.tar.gz
(5.3 kB
view details)
File details
Details for the file filez-0.13.tar.gz
.
File metadata
- Download URL: filez-0.13.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.6 tqdm/4.62.2 importlib-metadata/4.8.2 keyring/23.5.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.8.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 216a072a16f585c244e3cc028c0a54bcb94b5eb34fa002f48230e184c3046e48 |
|
MD5 | c218c3470546c4d8389d6f262e10fe9d |
|
BLAKE2b-256 | 3ef058eb1383f65bc6b053353d41652c73030c63b5c98e00631fc9b1bf745e8d |