skip to navigation
skip to content

bencode.py 2.0.0

Simple bencode parser (for Python 2, Python 3 and PyPy)

Simple bencode parser (for Python 2, Python 3 and PyPy), forked from the bencode package by Thomas Rampelberg.

Usage

Encode:

import bencode

bencode.encode({'title': 'Example'})
# 'd5:title7:Examplee'

bencode.encode(12)
# 'i12e'

Decode:

import bencode

bencode.decode('d5:title7:Examplee')
# {'title': 'Example'}

bencode.decode('i12e')
# 12

API

bencode.bencode(value)

bencode.encode(value)

Encode value into the bencode format.

bencode.bdecode(value)

bencode.decode(value)

Decode bencode formatted string value.

bencode.bread(fd)

Read bencode formatted string from file or path fd.

bencode.bwrite(data, fd)

Write data as a bencode formatted string to file or path fd.
 
File Type Py Version Uploaded on Size
bencode.py-2.0.0-py2.py3-none-any.whl (md5) Python Wheel py2.py3 2017-12-05 6KB
bencode.py-2.0.0.tar.gz (md5) Source 2017-12-05 7KB