Created
March 30, 2019 02:40
-
-
Save loonghao/3f366a96d6351a9aa8294b90da80b603 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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