The following should do what you want, assuming I understand your question correctly.
Note: I check for the existence of the key before overwriting it and instead put it under a slightly different name otherwise.
import yaml
config_file = open('myFile', 'r')
config = yaml.read(config_file)
keys = config.keys()
values = config.values()
for key,val in zip(keys,values):
if key not in locals():
locals()[key] = val
else:
locals()[key+"_yaml"] = val
While this works, I would actually suggest you just stick to having a dictionary with your values in them. What's wrong with just referencing a dictionary if a local variable doesn't exist?