Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
filter, replace solution in Clear category for YAML. More Types by Sioul
def yaml(a):
obj = dict()
for line in filter(bool, a.splitlines()):
k,v = map(str.strip, line.split(':'))
if v in ('true', 'false'):
obj[k] = (v == 'true')
elif v in ('null', ''):
obj[k] = None
else:
try:
obj[k] = int(v)
except ValueError:
v = v.replace('\\"', '£').strip('"\'').replace('£', '"')
obj[k] = v
return obj
Nov. 11, 2019