Skip to content

Commit

Permalink
Added json.dumps to create_list.py
Browse files Browse the repository at this point in the history
  • Loading branch information
swackhap committed Jan 21, 2016
1 parent f51be10 commit a0525f9
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
19 changes: 19 additions & 0 deletions asdf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- dog
- cat
- attribs:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
ip_addr: 192.168.255.21
9 changes: 8 additions & 1 deletion create_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,17 @@
print 'yaml.dump(list, default_flow_style=True)'
print yaml.dump(list, default_flow_style=True)

print 'json.dumps(list)'
print json.dumps(list)

#yaml filename
yaml_filename = filename_base + '.yml'
print 'Writing yaml file ' + filename_base + '.yml'
with open(yaml_filename, "w") as f:
f.write(yaml.dump(list, default_flow_style=False))


#json filename
json_filename = filename_base + '.json'
print 'Writing json file ' + json_filename
with open(json_filename, "w") as f:
json.dumps(list,f)
Empty file added qwer.json
Empty file.
19 changes: 19 additions & 0 deletions qwer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- dog
- cat
- attribs:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
ip_addr: 192.168.255.21

0 comments on commit a0525f9

Please sign in to comment.