Closed varunpatro closed 8 years ago
Hi,
AFAIK it is not possible to serialize unicode
(or str
in Python 3) using the struct
module. You have to manually encode vals
to bytes
and then pass them to RecordTrie
:
trie = matrisa_trie.RecordTrie("s", zip(keys, map(vals, str.encode)))
If I have the following variables:
keys = [u'1', u'12', u'13', u'123', u'132', u'1234'] vals = [u'a', u'b', u'c', u'd', u'e', u'f'] fmt = "s" trie = marisa_trie.RecordTrie(fmt, zip(keys, vals))
But I keep getting
argument for 's' must be a string
Any help?