On 2018-04-26, Alan Gauld via Tutor wrote:
> OTOH its definitely not good OOP, ther are no methods and we
> are just using the class as a record. (A named tuple might
> actually be a better option on reflection.)
namedtuple is great in lots of cases, but sometimes it transpires
I wish to make alt
On 26/04/18 14:48, Mats Wichmann wrote:
>>> However personally I'd use a class to define your data structure and
>>> just have a top level dictionary holding instances of the class.
>>
>> You are right (again). I haven't thougt of using classes, but that's exactly
>> what they were invented for. T
On 04/25/2018 12:46 PM, Kai Bojens wrote:
> On 25/04/2018 –– 18:35:30PM +0100, Alan Gauld via Tutor wrote:
>>> ...
>>> for line in logfile:
>>> result = pattern.search(line)
>
>> Doesn't this overwrite your data structure?
>> I would strongly advise using another name.
>
> You are of
On 25/04/2018 –– 18:35:30PM +0100, Alan Gauld via Tutor wrote:
> > ...
> > for line in logfile:
> > result = pattern.search(line)
> Doesn't this overwrite your data structure?
> I would strongly advise using another name.
You are of course right. I accidentally shortened this name as
On 25/04/18 14:22, Kai Bojens wrote:
> The structure I'd like to have:
>
> result = {
> 'f...@bar.de': {
> 'Countries': [DE,DK,UK]
> 'IP': ['192.168.1.1','172.10.10.10']
> 'Count': [12]
> }
> }
> ...
> for line in logfile:
>
Hello everybody,
I'm coming from a Perl background and try to parse some Exim Logfiles into a
data structure of dictionaries. The regex and geoip part works fine and I'd
like to save the email adress, the countries (from logins) and the count of
logins.
The structure I'd like to have:
result = {