repo.or.cz
/
hband-tools.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
new tool: args2env
[hband-tools.git]
/
user-tools
/
bencode2json
blob
c2fc13dcf151d181de021b63aea72dbc656d0299
1
#!/usr/bin/env python
2
3
"""
4
=pod
5
6
=head1 NAME
7
8
bencode2json - Convert Bencode (BitTorrent's loosely structured data) to JSON
9
10
=cut
11
12
"""
13
14
import
sys
15
import
json
16
import
bencode
17
18
print
json
.
dumps
(
bencode
.
bdecode
(
''
.
join
(
sys
.
stdin
.
readlines
())),
ensure_ascii
=
False
)