Fix up README example
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Luke Murphy 2020-08-05 08:28:38 +02:00
parent f53d9c23ca
commit e6eb8b3746
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 11 additions and 6 deletions

View File

@ -18,13 +18,18 @@ $ pip install pyvarint
## Example ## Example
```python ```python
from random import sample
from pyvarint import decode, encode from pyvarint import decode, encode
ten_rand_ints = sample(range(100), 10) encoded = encode(666)
decoded = decode(encoded)
for rand_int in ten_rand_ints: print("number: 666", f"encoded: {encoded}", f"decoded: {decoded}", sep="\n")
encoded = encode(rand_int) ```
decoded = decode(encoded)
assert decoded == rand_int Output:
```sh
number: 666
encoded: b'\x9a\x05'
decoded: 666
``` ```