database - Easy way to store multiple data in Python 3 -
i pretty new python, , far haven't stumbled upon problems, until now. need data structure allows me store multi dimensional data. example, need irc bot store users , modes on channel. this:
[name][users][nicklist][modes][topic][etc] [#home][50]['nick1', 'nick2', 'nick3', 'etc'][+nt][topic here][more info] [#otherchan][10]['nick1', 'nick2', 'nick3', 'etc'][+][topic][more info]
and need recall , edit information via channel name. been looking lists , arrays have not found convenient way accomplish this.
if there better way this, that'd great too. hope i'm explaining myself well.
it sounds want use dict
object.
d = {} d['#home'] = {} d['#home']['users'] = 50 d['#home']['nicklist'] = ['nick 1', 'nick 2']
and on
you can retrieve values array
print d['#home']['users'] 50
Comments
Post a Comment