@@ -11,7 +11,7 @@ Pyben Enables fast and easy encoding and decoding of bencoded data.
1111
1212## Prerequisites
1313
14- * Python3 installed and enabled
14+ * Python3 installed and enabled
1515
1616## Installing PyBen
1717
@@ -29,34 +29,28 @@ Using git:
2929
3030The API is intentionally designed to mimic Python's json module.
3131
32- ```python
33- >>> fd = "path/to/file"
34- >>> data = {"item1": ["item2", 3, [4], {5: "item6"}]}
35- >>> encoded = pyben.dumps(data)
36- >>> encoded
37- ... b'd5:item1l5:item2i3eli4eedi5e5:item6eee'
38- >>> decoded = pyben.loads(encoded)
39- ... {'item1': ['item2', 3, [4], {5: 'item6'}]}
40- ```
32+ >>> fd = "path/to/file"
33+ >>> data = {"item1": ["item2", 3, [4], {5: "item6"}]}
34+ >>> encoded = pyben.dumps(data)
35+ >>> encoded
36+ ... b'd5:item1l5:item2i3eli4eedi5e5:item6eee'
37+ >>> decoded = pyben.loads(encoded)
38+ ... {'item1': ['item2', 3, [4], {5: 'item6'}]}
4139
4240One key difference is that the 'load' and 'dump' methods accept as arguments,
4341string paths or path objects as well as open iobuffer.
4442
4543For Example this:
4644
47- ```python
48- >> with open("encoded.file", "wb") as fd:
49- ... pyben.dump(data, fd)
50- >> with open("encoded.file", "rb") as fd:
51- ... decoded = pyben.load(fd)
52- ```
45+ >> with open("encoded.file", "wb") as fd:
46+ ... pyben.dump(data, fd)
47+ >> with open("encoded.file", "rb") as fd:
48+ ... decoded = pyben.load(fd)
5349
5450is the same as doing following.
5551
56- ```python
57- >>> pyben.dump(data, "encoded.file")
58- >>> decoded = pyben.load("encoded.file")
59- ```
52+ >>> pyben.dump(data, "encoded.file")
53+ >>> decoded = pyben.load("encoded.file")
6054
6155The full API includes many other functions and classes as well.
6256See docs for more full API.
0 commit comments