Answer the question
In order to leave comments, you need to log in
How to convert yaml to json from python without libraries?
A friend here asked me to help him with a python lab ... The trick is that you need to translate uml into python, without any libraries The structure of
the
umla will always be
like
this please guys
lines = {}
outputfile = open('output.json','w')
last_checked = "children"
string = "{"
flag = False
def rr(fd):
for line in fd:
line = line.strip()
if line == '':
return
k, v = line.split(":", maxsplit = 1)
if v:
return {k: rr(k, v)}
else:
return {k: v}
with open("Input.yml", "r") as fd:
print(fd)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question