def yml_to_json(filename):
 jsonfilename = '{0}.json'.format(*os.path.splitext(filename))
 with open(filename, 'r') as f:
  contents = yaml.load(f)
 with open(jsonfilename, 'w') as f:
  json.dump(contents, f)

def yml_to_json ( filename ) : jsonfilename = '{0}.json' . format ( * os . path . splitext ( filename ) ) with open ( filename , 'r' ) as f : contents = yaml . load ( f ) with open ( jsonfilename , 'w' ) as f : json . dump ( contents , f )
convert a .