开发者

how to model bitarrays in django?

What would be the best way to store a large bitarray within a django model (mysql backend)?

for example, how could i store this object:

import bitarray开发者_Go百科
bits = bitarray.bitarray('11000101010') #real data is 35k bits long

Should i just shove it in a CharField?


MySQL has a BLOB field type that's worth considering.

Or you could converting it to a hex string, prefixed with the length, which would take up less than 9KB:

"11,C54"

Or ASCII-85, which would take up less space than hex.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜