summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2016-04-17 20:40:37 +0200
committerIlya Etingof <etingof@gmail.com>2016-04-17 20:40:37 +0200
commit8fd98139e8f568f239a6e3d0d2532c7cdefb0bd7 (patch)
tree75fc6af89db98ae5832c0a91d1f9fb3a2ecaddc1 /README.md
parentfa78f1b0b3cd8c9628f8862ce1c19b7597a08be6 (diff)
downloadpyasn1-git-8fd98139e8f568f239a6e3d0d2532c7cdefb0bd7.tar.gz
example improved
Diffstat (limited to 'README.md')
-rw-r--r--README.md15
1 files changed, 14 insertions, 1 deletions
diff --git a/README.md b/README.md
index 078b012..1eaaf58 100644
--- a/README.md
+++ b/README.md
@@ -92,8 +92,21 @@ turn serialized ASN.1 content, as received from network or read from a file,
into a fully-fledged, initialized data structure.
```python
->>> encode(record)
+>>> substrate = encode(record)
+>>> substrate
b'0\x07\x02\x01{\x80\x02\x01A'
+>>>
+>>> decoded_record, substrate = decode(substrate, asn1Spec=Record())
+>>>
+>>> print(decoded_record.prettyPrint())
+Record:
+ id=123
+ room=321
+ house=0
+>>>
+>>> record == decoded_record
+True
+>>>
```
Many high-profile Internet protocols and file formats utilize ASN.1 serialization.