Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
west-public
westpy
Commits
f1bfdfcc
Commit
f1bfdfcc
authored
Jul 10, 2018
by
Marco Govoni
Browse files
Added Yaml 2 Json converter
parent
e0f8dcc3
Changes
3
Hide whitespace changes
Inline
Side-by-side
doc/installation.rst
View file @
f1bfdfcc
...
...
@@ -10,6 +10,7 @@ The software is tested for python version 3.x and has the following dependencies
- ``numpy``
- ``scipy``
- ``matplotlib``
- ``pyyaml``
- ``datetime``
- ``requests``
- ``mendeleev``
...
...
setup.py
View file @
f1bfdfcc
...
...
@@ -12,6 +12,7 @@ setup(name='westpy',
'numpy'
,
'scipy'
,
'matplotlib'
,
'pyyaml'
,
'datetime'
,
'requests'
,
'mendeleev'
,
...
...
westpy/utils.py
View file @
f1bfdfcc
...
...
@@ -126,6 +126,27 @@ def readJsonFile(fname):
print
(
"File read : "
,
fname
)
return
data
def
convertYaml2Json
(
fyml
,
fjson
):
"""Converts the file from YAML to JSON.
:param fyml: Name of YAML file
:type fyml: string
:param fjson: Name of JSON file
:type fjson: string
:Example:
>>> from westpy import *
>>> convertYaml2Json("file.yml","file.json")
.. note:: The file fjon will be created, fyml will not be overwritten.
"""
#
import
yaml
,
json
from
westpy
import
writeJsonFile
#
data
=
yaml
.
load
(
open
(
fyml
))
writeJsonFile
(
fjson
,
data
)
def
listLinesWithKeyfromOnlineText
(
url
,
key
):
"""List lines from text file located at url, with key.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment