Last active
August 29, 2015 14:26
-
-
Save Ashex/e5a9a6e37a30e59043ae to your computer and use it in GitHub Desktop.
Accepts a yaml file containing a list of regions as an argument and does stuff with each.
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
#!/usr/bin/env python | |
import argparse, yaml | |
def region(regiondict): | |
for i in regiondict: | |
print(i) | |
def main(): | |
parser = argparse.ArgumentParser(description='Do stuff with this region') | |
parser.add_argument('-r', '--region', help='Yaml file containing a bunch of regions') | |
args = parser.parse_args() | |
region_file = open(args.region, 'r') | |
region_dict = yaml.safe_load(region_file) | |
region(region_dict['region']) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
region_list.yml