#-*- coding: utf-8 -*- import base str = 'cnblogs' str = base.bencode(str) print str #Y25ibG9ncw== print base.bdecode(str) #cnblogs