Re: save dictionary to a file without brackets.

2012-08-09 Thread Roman Vashkevich
for key in dict: print key[0], key[1], dict[key] 10.08.2012, в 0:11, giuseppe.amatu...@gmail.com написал(а): > Hi, > I have a dict() unique > like this > {(4, 5): 1, (5, 4): 1, (4, 4): 2, (2, 3): 1, (4, 3): 2} > and i want to print to a file without the brackets comas and semicolon in > ord

Re: save dictionary to a file without brackets.

2012-08-09 Thread Roman Vashkevich
dict.items() is a list - linear access time whereas with 'for key in dict:' access time is constant: http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#use-in-where-possible-1 10.08.2012, в 0:35, Tim Chase написал(а): > On 08/09/12 15:22, Roman Vashkevich wrot

Re: save dictionary to a file without brackets.

2012-08-09 Thread Roman Vashkevich
1, Roman Vashkevich wrote: >> 10.08.2012, в 0:35, Tim Chase написал(а): >>> On 08/09/12 15:22, Roman Vashkevich wrote: >>>>> {(4, 5): 1, (5, 4): 1, (4, 4): 2, (2, 3): 1, (4, 3): 2} >>>>> and i want to print to a file without the brackets comas and se

Re: save dictionary to a file without brackets.

2012-08-09 Thread Roman Vashkevich
10.08.2012, в 1:47, Dave Angel написал(а): > On 08/09/2012 05:34 PM, Roman Vashkevich wrote: >> Actually, they are different. >> Put a dict.{iter}items() in an O(k^N) algorithm and make it a hundred >> thousand entries, and you will feel the difference. >> Dict uses

Re: [newbie] A question about lists and strings

2012-08-10 Thread Roman Vashkevich
10.08.2012, в 13:19, Mok-Kong Shen написал(а): > > In an earlier question about lists, I was told about the issue of > creation of local names in a function. However, I still can't > understand why the program below outputs: > > [999] sss > [999] > > and not two identical lines of output. For b

Re: [newbie] A question about lists and strings

2012-08-10 Thread Roman Vashkevich
10.08.2012, в 13:28, Roman Vashkevich написал(а): > 10.08.2012, в 13:19, Mok-Kong Shen написал(а): > >> >> In an earlier question about lists, I was told about the issue of >> creation of local names in a function. However, I still can't >> understand why the

Re: [newbie] A question about lists and strings

2012-08-10 Thread Roman Vashkevich
10.08.2012, в 14:12, Mok-Kong Shen написал(а): > Am 10.08.2012 11:48, schrieb Roman Vashkevich: >> [snip] > >The function It takes list by reference and creates a new local > > str. When it's called with listb and strb arguments, listb is passed > > by refe

Re: [newbie] A question about lists and strings

2012-08-10 Thread Roman Vashkevich
10.08.2012, в 14:12, Mok-Kong Shen написал(а): > Am 10.08.2012 11:48, schrieb Roman Vashkevich: >> [snip] > >The function It takes list by reference and creates a new local > > str. When it's called with listb and strb arguments, listb is passed > > by refe