Advertisement
Guest User

Untitled

a guest
Apr 10th, 2020
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. import sys
  2.  
  3. from ruamel.yaml import YAML
  4.  
  5. yaml = YAML(typ='safe')
  6. docs = yaml.load_all(sys.stdin)
  7.  
  8. ABI_id = 42  # hard coded as I don't have your DB
  9. csv = []
  10. try:
  11.     for doc_nr, doc in enumerate(docs, start=1):
  12.         csv.append(f"{ABI_id}\t{doc['origin']}\t{doc['name']}\t{doc['version']}")
  13. except Exception as ex:
  14.     print(f"Exception while parsing document number: {doc_nr}", ex)
  15. print("\n".join(csv))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement