Created
February 9, 2012 02:00
-
-
Save mrdaemon/1776464 to your computer and use it in GitHub Desktop.
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 | |
>>> stream = file('general_skills.yaml', 'r') | |
>>> skills = yaml.load_all(stream) | |
>>> skills | |
<generator object load_all at 0x02B29698> | |
>>> for skill in skills: | |
print skill | |
# So you end up with one dict per skill, which can be accessed using dict['key'] to get the values. | |
# The specializations, if applicable, return a python dict of multiple items as a value. | |
# I think this is the cleanest, simplest approach. | |
{'oh_cost': 4, 'stat': 'Body', 'name': 'Acrobatics', 'mm_cost': 2, 'hg_cost': 4, 'so_cost': 3, 'ma_cost': 5, 'mf_cost': 3, 'tr_cost': 3, 'cp_cost': 4, 'specializations': ['Balance', 'Flexibility', 'Jumps', 'Tumbling'], 'description': 'Roll well.'} | |
{'oh_cost': 1, 'stat': 'Soul', 'name': 'Animal Training', 'mm_cost': 1, 'hg_cost': 1, 'so_cost': 1, 'mf_cost': 1, 'tr_cost': 1, 'cp_cost': 1, 'ma_cost': 1, 'description': 'Train animals.'} | |
{'oh_cost': 1, 'stat': 'Mind', 'name': 'Architecture', 'mm_cost': 2, 'hg_cost': 1, 'so_cost': 1, 'ma_cost': 1, 'mf_cost': 2, 'tr_cost': 1, 'cp_cost': 2, 'specializations': ['Aquatic', 'Bridges', 'Small Buildings', 'Skyscrapers', 'Fortifications'], 'description': 'Build things.'} | |
>>> |
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
--- | |
name: Acrobatics | |
stat: Body | |
description: Roll well. | |
cp_cost: 4 | |
hg_cost: 4 | |
ma_cost: 5 | |
mf_cost: 3 | |
mm_cost: 2 | |
oh_cost: 4 | |
so_cost: 3 | |
tr_cost: 3 | |
specializations: | |
- Balance | |
- Flexibility | |
- Jumps | |
- Tumbling | |
--- | |
name: Animal Training | |
stat: Soul | |
description: Train animals. | |
cp_cost: 1 | |
hg_cost: 1 | |
ma_cost: 1 | |
mf_cost: 1 | |
mm_cost: 1 | |
oh_cost: 1 | |
so_cost: 1 | |
tr_cost: 1 | |
--- | |
name: Architecture | |
stat: Mind | |
description: Build things. | |
cp_cost: 2 | |
hg_cost: 1 | |
ma_cost: 1 | |
mf_cost: 2 | |
mm_cost: 2 | |
oh_cost: 1 | |
so_cost: 1 | |
tr_cost: 1 | |
specializations: | |
- Aquatic | |
- Bridges | |
- Small Buildings | |
- Skyscrapers | |
- Fortifications |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment