Skip to content

Instantly share code, notes, and snippets.

@loonghao
Created March 30, 2019 02:40
Show Gist options
  • Save loonghao/3f366a96d6351a9aa8294b90da80b603 to your computer and use it in GitHub Desktop.
Save loonghao/3f366a96d6351a9aa8294b90da80b603 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
"""
module author: Long Hao <[email protected]>
"""
from pprint import pprint
class ChRecord(object):
def __init__(self, namespace, file_path, sel_sets=None):
super(ChRecord, self).__init__()
self.sel_sets = []
if sel_sets:
self.sel_sets = sel_sets
self.namespace = namespace
self.filepath = file_path
data_list = {}
test_data = [
('test1', 'c:/test1',
'Animation:stuff_Junk1 0-10, animation:bob_jeff2 10-30'),
('test2', 'c:/test2',
'Animation:stuff_Junk2 0-10, animation:bob_jeff2 10-30'),
('test3', 'c:/test4',
'Animation:stuff_Junk3 0-10, animation:bob_jeff2 10-30'),
]
for data in test_data:
data_list.update({data[0]: ChRecord(*data)})
pprint(data_list)
info = data_list['test1']
# Get data.
print info.namespace
# remove data.
# Reference: https://docs.python.org/3/library/stdtypes.html#dict.pop
data_list.pop('test1')
info = data_list['test1']
print info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment