Semi-Newbie needs a little help

Rhodri James rhodri at wildebst.demon.co.uk
Mon Jul 6 20:58:07 EDT 2009


On Tue, 07 Jul 2009 00:29:36 +0100, Nile <nile_mcadams at 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
> 	hashtable[k] = hashtable.get(k,0) + 1
>
>
> hashtable_list = hashtable.values()
> print "here is a list of the dictionary values ", hashtable_list
> print "the length of the dictionary is ", len(hashtable)
>
> Output
> # The first 3 lines are printed from the function
> # right before the return statement.  This output
> # snippet shows the last two stocks.  The function
> # SAYS it is returning the correct value but only
> # the last date seems to make it to the hashtable
> Function will return k which = 11/11/2008
> Function will return k which = 11/12/2008
> Function will return k which = 11/14/2008

Have you checked the indentation of the print statement
that produces this?  Is it perhaps inside a loop still?

-- 
Rhodri James *-* Wildebeest Herder to the Masses



More information about the Python-list mailing list