Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import io
- import sys
- from ruamel.yaml import YAML
- sys.stdin = io.TextIOWrapper(sys.stdin.buffer, errors='replace')
- yaml = YAML(typ='safe')
- docs = yaml.load_all(sys.stdin)
- ABI_id = 42 # hard coded as I don't have your DB
- csv = []
- doc_nr = 0
- try:
- for doc_nr, doc in enumerate(docs, start=1):
- csv.append(f"{ABI_id}\t{doc['origin']}\t{doc['name']}\t{doc['version']}")
- print('\n'.join(csv))
- except Exception as ex:
- print(f'Exception while parsing document number: {doc_nr}', ex)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement