Я ищу самый быстрый способ повторно фактор, следующий список, который содержит dicts как элементыСортировка Python список contating dicts
[{u'domain': u'1d663096.bestapp243.biz',
u'flag_char_code': u'DR',
u'flag_hex': u'8081',
u'identifier': u'0000000002264A00',
u'indicator': u'Snd',
u'ip': u'172.30.133.105',
u'proto': u'UDP',
u'r_q': u'R Q',
u'raw': u'10/12/2014 11:20:27 AM 1114 PACKET 0000000002264A00 UDP Snd 172.30.133.105 aba2 R Q [8081 DR NOERROR] A .1d663096.bestapp243.biz.',
u'record': u'A',
u'status': u'NOERROR',
u'thread_id': u'1114',
u'timestamp': u'2014-10-12T11:20:27',
u'xid': u'aba2'},
{u'domain': u'1d663096.bestapp243.biz',
u'flag_char_code': u'DR',
u'flag_hex': u'8081',
u'identifier': u'0000000002264A00',
u'indicator': u'Snd',
u'ip': u'172.30.133.105',
u'proto': u'UDP',
u'r_q': u'R Q',
u'raw': u'10/12/2014 11:20:27 AM 1114 PACKET 0000000002264A00 UDP Snd 172.30.133.105 aba2 R Q [8081 DR NOERROR] A .1d663096.bestapp243.biz.',
u'record': u'A',
u'status': u'NOERROR',
u'thread_id': u'1114',
u'timestamp': u'2014-10-12T11:20:27',
u'xid': u'aba2'},
{u'domain': u'mgames.cf',
u'flag_char_code': u'DR',
u'flag_hex': u'8081',
u'identifier': u'000000000220ED40',
u'indicator': u'Snd',
u'ip': u'172.30.138.116',
u'proto': u'UDP',
u'r_q': u'R Q',
u'raw': u'10/13/2014 2:31:46 PM 110C PACKET 000000000220ED40 UDP Snd 172.30.138.116 f957 R Q [8081 DR NOERROR] A .mgames.cf.',
u'record': u'A',
u'status': u'NOERROR',
u'thread_id': u'110C',
u'timestamp': u'2014-10-13T14:31:46',
u'xid': u'f957'},
{u'domain': u'google.com',
u'flag_char_code': u'DR',
u'flag_hex': u'8081',
u'identifier': u'0000000002264A00',
u'indicator': u'Snd',
u'ip': u'172.30.133.105',
u'proto': u'UDP',
u'r_q': u'R Q',
u'raw': u'10/12/2014 11:20:27 AM 1114 PACKET 0000000002264A00 UDP Snd 172.30.133.105 aba2 R Q [8081 DR NOERROR] A .google.com.',
u'record': u'A',
u'status': u'NOERROR',
u'thread_id': u'1114',
u'timestamp': u'2014-10-12T11:20:27',
u'xid': u'aba2'},
{u'domain': u'qwe.domainsworkingsdromms.com',
u'flag_char_code': u'DR',
u'flag_hex': u'8381',
u'identifier': u'030E8D88',
u'indicator': u'Snd',
u'ip': u'172.27.29.77',
u'proto': u'UDP',
u'r_q': u'R Q',
u'raw': u'10/14/2014 10:37:13 AM 17E0 PACKET 030E8D88 UDP Snd 172.27.29.77 80eb R Q [8381 DR NXDOMAIN] A .qwe.domainsworkingsdromms.com.',
u'record': u'A',
u'status': u'NXDOMAIN',
u'thread_id': u'17E0',
u'timestamp': u'2014-10-14T10:37:13',
u'xid': u'80eb'}]
на выходе что-то вроде:
{
'172.30.133.105': {
'1d663096.bestapp243.biz':
[
{u'domain': u'1d663096.bestapp243.biz',
u'flag_char_code': u'DR',
u'flag_hex': u'8081',
u'identifier': u'0000000002264A00',
u'indicator': u'Snd',
u'ip': u'172.30.133.105',
u'proto': u'UDP',
u'r_q': u'R Q',
u'raw': u'10/12/2014 11:20:27 AM 1114 PACKET 0000000002264A00 UDP Snd 172.30.133.105 aba2 R Q [8081 DR NOERROR] A .1d663096.bestapp243.biz.',
u'record': u'A',
u'status': u'NOERROR',
u'thread_id': u'1114',
u'timestamp': u'2014-10-12T11:20:27',
u'xid': u'aba2'},
{u'domain': u'1d663096.bestapp243.biz',
u'flag_char_code': u'DR',
u'flag_hex': u'8081',
u'identifier': u'0000000002264A00',
u'indicator': u'Snd',
u'ip': u'172.30.133.105',
u'proto': u'UDP',
u'r_q': u'R Q',
u'raw': u'10/12/2014 11:20:27 AM 1114 PACKET 0000000002264A00 UDP Snd 172.30.133.105 aba2 R Q [8081 DR NOERROR] A .1d663096.bestapp243.biz.',
u'record': u'A',
u'status': u'NOERROR',
u'thread_id': u'1114',
u'timestamp': u'2014-10-12T11:20:27',
u'xid': u'aba2'},
],
'google.com':
[
{u'domain': u'google.com',
u'flag_char_code': u'DR',
u'flag_hex': u'8081',
u'identifier': u'0000000002264A00',
u'indicator': u'Snd',
u'ip': u'172.30.133.105',
u'proto': u'UDP',
u'r_q': u'R Q',
u'raw': u'10/12/2014 11:20:27 AM 1114 PACKET 0000000002264A00 UDP Snd 172.30.133.105 aba2 R Q [8081 DR NOERROR] A .google.com.',
u'record': u'A',
u'status': u'NOERROR',
u'thread_id': u'1114',
u'timestamp': u'2014-10-12T11:20:27',
u'xid': u'aba2'}
]
},
'172.30.138.116': {
'mgames.cf':
[
{u'domain': u'mgames.cf',
u'flag_char_code': u'DR',
u'flag_hex': u'8081',
u'identifier': u'000000000220ED40',
u'indicator': u'Snd',
u'ip': u'172.30.138.116',
u'proto': u'UDP',
u'r_q': u'R Q',
u'raw': u'10/13/2014 2:31:46 PM 110C PACKET 000000000220ED40 UDP Snd 172.30.138.116 f957 R Q [8081 DR NOERROR] A .mgames.cf.',
u'record': u'A',
u'status': u'NOERROR',
u'thread_id': u'110C',
u'timestamp': u'2014-10-13T14:31:46',
u'xid': u'f957'}
]
}
}
Должен ли я разделить их в два списка, первый будет иметь ips в качестве ключей, а затем перебирать их, чтобы исправить домены в качестве ключей для sub dicts?
Любые идеи будут оценены. Благодаря