1
2
3
4
5
6
7
8
9
10
11
12
13
14
| import cbor
|
| data = {
| "name": "python-cbor",
| "versions": ["1", "2"],
| "group": {
| "is_a_package": True,
| "value": 42
| }
| }
| serialized = cbor.dumps(data)
| print(serialized.decode(errors="ignore"))
| with open("/tmp/data.cbor", "wb") as f:
| f.write(serialized)
|
|