Multiple values for one key
norseman
norseman at hughes.net
Wed Aug 27 21:43:16 EDT 2008
Terry Reedy wrote:
>
>
> Ron Brennan wrote:
>> Hello,
>>
>>
>> How would I create a dictionary that contains multiple values for one
>> key.
>
> Make the value a collection object (set or list if you plan to add and
> delete).
>
>> I'd also like the key to be able to have duplicate entries.
>
> Dict keys must be hashable and unique.
>
> tjr
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
================
First part I understand, second is still giving me a problem.
For some reason I still want keys to be dbf column headers.
like:
name:address:zip so forth
---- ------- --- ------------------
guy: unknown:00000
girl: 123 tiny street:12345
boy:321 here:33333
gal:999 over there: 55555
so forth
Thus one key has many values. And you can then index on whatever key(s)
you wish - name,zip...
With billions plus records, trying to put a unique key on each entry
seems to preclude the need for a dictionary, just use the entries.
(Format to SDF and index on substr(line,1,24)+substr(line,48,+5) etc..)
name + zip
OK - I know I missed the whole concept of a Python Dictionary. I haven't
read anything as yet that gives a clear picture of what it is and what
it is for. Please, classroom concepts usually consist of a handful of
objects. I have files here that takes up multiple DVDs each, AFTER a 15
to 1 compression. 3 bytes per pixel. I need to work with them. Things
like changing geobase projections and cookie cutting based on real world
coordinates and modifying the lumens and so forth. Based on what I've
read, the Python Dictionary concept flat will not work for such as this.
Yes - the example is overkill. But in my world it is reality. I deal
with sizeable things. Not all are raster. Most all are binary! Things
that work on massive text files - like banking and mortgage - simply
don't work here. There are seldom 'lines'. There are always bytes. Lots
of bytes. Things that form a group are not necessarily stored sequentially.
Back to What Is A Python Dictionary: Somebody please enlighten me.
Steve
norseman at hughes.net
More information about the Python-list
mailing list