best way to do this ...

Thomas Guettler guettli at thomas-guettler.de
Tue May 17 10:18:33 EDT 2005


Am Tue, 17 May 2005 05:26:15 -0700 schrieb Tonino:

> Hi ALL,
> 
> I am having a issue with a particular storage of data problem and
> wanted to know if I am going about it the wrong way.
> 
> I have a list of reference numbers associated with a product and I have
> a socket that listens on a port.  Now what happens is the client app
> connects to the server - sends the product and the associated ref
> numbers (there are a few per product). I need to be able to store these
> in a data  structure so that when the same product is called again  -
> it can display the ref numbers for that product.

The smallest database is the filesystem. Create a directory for every
product. Store the references in a file in this directory.

> 
>     for a in Detail:
> RuntimeError: dictionary changed size during iteration

I did not see any dict in your code, but this message means, that you
can't change the dictionary in the loop. Maybe this helps:

for a, b in list(mydict.items()):
    ....


 Thomas

-- 
Thomas Güttler, http://www.thomas-guettler.de/





More information about the Python-list mailing list