Problem with loading textfiles into dictionaries.
Kartic
removethis.kartic.krishnamurthy at gmail.com
Sun Jan 30 20:28:59 EST 2005
Kartic said the following on 1/30/2005 8:21 PM:
> mercuryprey at gmail.com 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 not help.
>
> def do_load(self, arg):
> sitefile = file('sitelist', 'r+', 1)
> while True:
> siteline = sitefile.readline()
> if len(siteline) == 0:
> break
> site_rawlist = siteline.split()
> sitelist[site_rawlist[0]] = site_rawlist[1:]
Sorry...siteline = sitefile.readline().strip()
More information about the Python-list
mailing list