python - How can I load a saved JSON tree with treelib? -


i have made python script wherein process big html beautifulsoup while build tree using treelib: http://xiaming.me/treelib/. have found library comes methods save tree file on system , parsing json. after this, how can load it? not efficient build same entire tree each run. think can make function parse json tree written file want sure if there exists easy way or not.

thanks in advance

the simple answer

with this treelib, can't.

as in documentation (http://xiaming.me/treelib/pyapi.html#node-objects):

tree.save2file(filename[, nid[, level[, idhidden[, filter[, key[, reverse]]]]]]])     save tree file offline analysis. 

it not contain json-parser, can not read files.

what can do?

you have no other option building tree each time every run.

implement json-reader parses file , creates tree you.

https://docs.python.org/2/library/json.html


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -