[Tutor] Declaring a compound dictionary structure.

Ray Parrish crp at cmc.net
Sun Mar 14 00:06:49 CET 2010


I am stuck on the following -

                    # Define the Dates{} 
dictionary structure as a dictionary
                    # containing two dictionaries, 
each of which contains a list.
                    Dates = 

How do I pass this declaration empty values for 
Today, Tomorrow, and ThisIPAddress to initially 
clare it? I have managed to pass it [] as an empty 
list, but passing # "" as an empty dictionary 
label does not work correctly.

      Dates = {"":"":[]}, "":{"":[]}}

The above is what I tried, and that creates a 
dictionary with index values of "" for all of the 
key values from the previous declaration. Is there 
a way to create this comound dictionary structure 
with no key values defined at all to begin with? 
The reason I'd like to know is that with the 
second declaration the "" indexed keys  have to be 
removed after assigning at least one key value 
with a non-blank name.

The idea behind the structure is to sort through a 
server log that contains entries for two dates, 
collecting a pair of dictionaries of ip address 
indexed server log lines which can then be 
iterated over to
extract daily visit counts, and other extractable 
data sorted by date, and visitor.

The need would not arise if the log files did not 
contain two dates each, but my service provider 
rotates their server logs around 2 am, so I always 
get a few entries for the next day in every log file.

Thanks, Ray Parrish

Linux dpkg Software Report script set..
Ray's Links, a variety of links to usefull things, 
and articles by Ray.
Writings of "The" Schizophrenic, what it's like to 
be a schizo, and other
things, including my poetry.

More information about the Tutor mailing list