S
S
stepan-neretin72019-11-17 08:48:08
Python
stepan-neretin7, 2019-11-17 08:48:08

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)

Here is what I have so far ((any nonsense)
Here is the structure of the YAML file, the structure itself will not change I would be
grateful if you push

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question