Last active
February 16, 2021 00:52
-
-
Save thanakijwanavit/241c4cc443f39ea096820f5dfb84017d to your computer and use it in GitHub Desktop.
convert dict to yaml and vise versa in python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import yaml | |
| print(yaml.dump({'hello':'world', | |
| 'stacked': {'hello1':'world1'}})) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $schema: http://json-schema.org/schema# | |
| properties: | |
| cprcode: | |
| type: integer | |
| iprcode: | |
| type: integer | |
| oprCode: | |
| type: string | |
| required: | |
| - cprcode | |
| - iprcode | |
| - oprCode | |
| type: object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import yaml | |
| yaml.load('hello: world\nstacked:\n hello1: world1\n', , Loader=yaml.FullLoader) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment