Re: Problem with loading textfiles into dictionaries.

2005-01-30 Thread Steven Bethard
Kartic wrote: [EMAIL PROTECTED] said the following on 1/30/2005 7:43 PM: Hello, I want to do the following: def do_load(self, arg): sitefile = file('sitelist', 'r+', 1) while True: siteline = sitefile.readline() site_rawlist = siteline.split() sitelist[site_rawlist[0]] = site_rawlist[1:] if len(sit

Re: Problem with loading textfiles into dictionaries.

2005-01-30 Thread mercuryprey
Yeah I kind of want to 'reinvent' the pickle and I am aware of that. The problem for me is that the output that pickle dumps to a file is too 'cryptic' as I want the ability to edit the corresponding textfile directly and easily, so I'm going for an own way. But yes, Kartic and you were basically

Re: Problem with loading textfiles into dictionaries.

2005-01-30 Thread Kartic
Kartic said the following on 1/30/2005 8:21 PM: [EMAIL PROTECTED] said the following on 1/30/2005 7:43 PM: Hi - It looks like your code encountered a blank line when you got this error. You should move "if len(siteline) == 0" part right after your readline. The way you have done it really does

Re: Problem with loading textfiles into dictionaries.

2005-01-30 Thread Kartic
[EMAIL PROTECTED] said the following on 1/30/2005 7:43 PM: Hello, I want to do the following: def do_load(self, arg): sitefile = file('sitelist', 'r+', 1) while True: siteline = sitefile.readline() site_rawlist = siteline.split() sitelist[site_rawlist[0]] = site_rawlist[1:] if len(siteline) == 0: b

Re: Problem with loading textfiles into dictionaries.

2005-01-30 Thread M.E.Farmer
[EMAIL PROTECTED] wrote: > Hello, > I want to do the following: > > def do_load(self, arg): > sitefile = file('sitelist', 'r+', 1) > while True: > siteline = sitefile.readline() > site_rawlist = siteline.split() > sitelist[site_rawlist[0]] = site_rawlist[1:] > if len(siteline) == 0: > break > > I w

Re: Problem with loading textfiles into dictionaries.

2005-01-30 Thread Stephen Thorne
On 30 Jan 2005 16:43:26 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello, > I want to do the following: > > def do_load(self, arg): > sitefile = file('sitelist', 'r+', 1) > while True: > siteline = sitefile.readline() > site_rawlist = siteline.split() > sitelist[site_rawlist[0]] = site_