Difference between revisions of "Python yaml"

From UVOO Tech Wiki
Jump to navigation Jump to search
(Created page with "pip install pyyaml ``` import yaml with open("example.yaml", 'r') as stream: try: print(yaml.safe_load(stream)) except yaml.YAMLError as exc: print(e...")
 
 
Line 10: Line 10:
 
         print(exc)
 
         print(exc)
 
```
 
```
 +
 +
https://pypi.org/project/envyaml/
  
 
or use https://docs.python.org/3/library/configparser.html
 
or use https://docs.python.org/3/library/configparser.html

Latest revision as of 15:52, 23 May 2021

pip install pyyaml

import yaml

with open("example.yaml", 'r') as stream:
    try:
        print(yaml.safe_load(stream))
    except yaml.YAMLError as exc:
        print(exc)

https://pypi.org/project/envyaml/

or use https://docs.python.org/3/library/configparser.html