Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for YAML. Simple Dict by Tinus_Trotyl
def yaml(a):
def extint(data):
try: return int(data)
except ValueError: return data
result = dict()
for line in [line for line in a.split('\n') if line.strip()]:
key, val = line.split(':')
result[extint(key.strip())] = extint(val.strip())
return result
July 20, 2019
Comments: