[Baypiggies] python newbie
Jerome Jabson
jjabson at yahoo.com
Mon Mar 6 17:01:03 CET 2006
I'm having problems trying to parse a text file and
separating it's contents into a dictionary. The file
as something like:
name
This is the description of the name.
another_name
Another description of this name.
The dictionary should look like:
dict = {name: This is the description of the name.,
another_name: Another discription of this name}
I tried doing something like:
dict = {}
f = open("text-file", "r)
for line in f:
items = line
dict[items[0]] = items[1:]
print dict
but the dictionary comes out all wrong! :-( Can
someone give me some pointers on how to do this.
Help is much appreciated!
Jeff
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Baypiggies
mailing list