Posts tagged 'tdb'

Samba's tdbdump reimplemented in Python

Less than 150 characters in Python, while the original implementation in C requires more than 2000 characters

import tdb, sys

db = tdb.Tdb(sys.argv[1])
for (k, v) in db.iteritems():
    print "{\nkey(%d) = %r\ndata(%d) = %r\n}\n" % (len(k), k, len(v), v)
}

comments.