[Tutor] Dictionary Issue

Alan Gauld alan.gauld at btinternet.com
Fri Aug 7 08:35:05 CEST 2015


On 07/08/15 01:15, Ltc Hotspot wrote:
> Question1: How type of argument should I use for dict, i.e.,user argument
> or list argument.
>
> Read captured traceback:
>
> TypeError
> Traceback (most recent call last)
> C:\Users\vm\Desktop\apps\docs\Python\assignment_9_4_26.py in <module>()
>        1 fname = raw_input("Enter file name: ")
>        2 handle = open (fname, 'r')
> ----> 3 count = dict.keys()
>        4 for line in handle:
>        5     if line.startswith("From: "):


You appear to be making random changes to your code
for no good reason.

I will not make any further suggestions until you
start to explain your thinking.

What do you think the line

count = dict.keys()

will do? Why do you want to do that?
How will it help you solve your problem?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list