Expose two functions bencode
and bdecode
.
bencode
take one object as a parameter and returns bytes
.bdecode
take bytes
as a parameter and returns an object.objects may be of type
:
str
int
list
dict
You have to follow the bencode
encoding and decoding algorithm, see
Wikipedia bencode page.
You'll have to encode and decode strings, use "UTF-8" everywhere and explicitly.
You may code other helper
functions in your module,
functions to help bencode
and bdecode
in their work. You also can
store module variables and use them but only
for you to use.
There's no corrections yet, hit the `Submit` button to send your code to the correction bot.
Keyboard shortcuts: