Nile nile_mcad...@yahoo.com (N) wrote:
N I initialized the dictionary earlier in the program like this -
N hashtable = {}
N I changed the dict to hashtable but I still get the same result
N I will try to learn about the defaultdict but I'm just trying to keep
N it as simple as I can for now
Thanks all for your help. I appreciate it. The problem was in the
function. A simple bug which I should have caught but I had my mental
blinders on and was sure the problem was outside the function. The
answers have given me a lot to learn so thanks for that as well.
--
I am trying to write a simple little program to do some elementary
stock market analysis. I read lines, send each line to a function and
then the function returns a date which serves as a key to a
dictionary. Each time a date is returned I want to increment the value
associated with that date.
On Mon, Jul 6, 2009 at 3:02 PM, Nilenile_mcad...@yahoo.com wrote:
I am trying to write a simple little program to do some elementary
stock market analysis. I read lines, send each line to a function and
then the function returns a date which serves as a key to a
dictionary. Each time a date
On Mon, Jul 6, 2009 at 17:02, Nilenile_mcad...@yahoo.com wrote:
Code
for x in range(len(file_list)):
d = open(file_list[x] , r)
data = d.readlines()
k = above_or_below(data) # This
function seems to work correctly
print here is the value that
Chris Rebert wrote:
On Mon, Jul 6, 2009 at 3:02 PM, Nilenile_mcad...@yahoo.com wrote:
I am trying to write a simple little program to do some elementary
stock market analysis. I read lines, send each line to a function and
then the function returns a date which serves as a key to a
dictionary.
On Jul 6, 5:30 pm, Pablo Torres N. tn.pa...@gmail.com wrote:
On Mon, Jul 6, 2009 at 17:02, Nilenile_mcad...@yahoo.com wrote:
Code
for x in range(len(file_list)):
d = open(file_list[x] , r)
data = d.readlines()
k = above_or_below(data) # This
On Jul 6, 5:22 pm, Chris Rebert c...@rebertia.com wrote:
On Mon, Jul 6, 2009 at 3:02 PM, Nilenile_mcad...@yahoo.com wrote:
I am trying to write a simple little program to do some elementary
stock market analysis. I read lines, send each line to a function and
then the function returns a
On Tue, 07 Jul 2009 00:29:36 +0100, Nile nile_mcad...@yahoo.com wrote:
Revised code
for x in range(len(file_list)):
d = open(file_list[x] , r)
data = d.readlines()
k = 0
k = above_or_below(data)
print here is the value that was returned ,k
MRAB wrote:
div class=moz-text-flowed style=font-family: -moz-fixedNile wrote:
[snip]
I initialized the dictionary earlier in the program like this -
hashtable = {}
I changed the dict to hashtable but I still get the same result
I will try to learn about the defaultdict but I'm just trying
En Mon, 06 Jul 2009 19:49:41 -0300, MRAB pyt...@mrabarnett.plus.com
escribió:
Chris Rebert wrote:
from collections import defaultdict
counts = defaultdict(lambda: 0)
Better is:
counts = defaultdict(int)
For speed? This is even faster:
zerogen = itertools.repeat(0).next
counts =
11 matches
Mail list logo