Last active
May 10, 2018 18:17
-
-
Save jeremy-donson/31db7a69cb7ca1b9c01e4521f36f68d4 to your computer and use it in GitHub Desktop.
This file contains 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
$ pip3 install pyyaml | |
$ python3 | |
>>> import yaml | |
>>> yaml.load(""" | |
... - Hdf | |
... - Jgd | |
... - Kjhgd | |
... """) | |
['Hdf', 'Jgd', 'Kjhgd'] | |
>>> dat = yaml.load(""" | |
... - Hdf | |
... - Kjhgd | |
... - Jgd | |
... """) | |
>>> dat | |
['Hdf', 'Kjhgd', 'Jgd'] | |
>>> dat = yaml.load(""" | |
... List Name: | |
... - Hdf | |
... - Jgd | |
... - Kjhgd | |
... """) | |
>>> dat | |
{'List Name': ['Hdf', 'Jgd', 'Kjhgd']} | |
# write to file of dictname containing 1 list element per line | |
>>> for key in dat.keys(): | |
... dictname = key; | |
... some_data = dat[dictname] => ?? ERRORS RIGHT NOW | |
>>> path = '/users/sammy/' + dictname + '.txt' | |
>>> test-file = open(path,'w') | |
>>> write2file = test-file.write() | |
# write one line for every list element | |
# close file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Would like to add json and csv ascii text formats.