problems defining an empty list
Manuel Hendel
manuel at hendel.net
Wed Sep 25 04:10:11 EDT 2002
Thanks a lot, that worked fine.
Manuel
On Wed, Sep 25, 2002 at 01:00:31AM -0700, Sean 'Shaleh' Perry wrote:
> On Wednesday 25 September 2002 00:54, you wrote:
> > On Wed, Sep 25, 2002 at 12:40:12AM -0700, Sean 'Shaleh' Perry wrote:
> > > it sounds like you have a hidden piece of whitespace. Perhaps the code
> > > is indented when it should not be? If the code is not in a loop, class,
> > > if structure, etc then it should not be indented.
> >
> > Actually it is in a ... structure.
> > [....]
> > # empty list for lines per all domains
> > linesperdomains = []
> >
> > for domain in domains:
> > # empty list for lines
> > domainlines = []
> > for neededline in neededlines:
> > if domain == neededline[0]:
> > domainlines.append(neededline)
> > print len(domainlines)
> >
> > # empty list for lines per domain
> > linesperdomain = []
> > linesperdomain = [domain, domainlines]
> > print linesperdomain
> > [....]
> >
> > This ist just a part of the script.
> >
>
> One of python's annoyances is it treats a tab and a space as unique indent
> levels. So if you happen to use a space everywhere but one line or vice
> versa that can mess things up.
>
> I meant to comment on something else too.
>
> linesperdomain = [] is not needed since you initialize it to a new list on the
> next line.
>
>
--
Please don't lie to me, unless you're absolutely sure I'll never find out the
truth.
-Ashleigh Brilliant
(contributed by Chris Johnston)
More information about the Python-list
mailing list