Problem with a for loop and a list
Alexnb
alexnbryan at gmail.com
Wed Jul 2 04:31:38 EDT 2008
Actually I tried that and had no sucsess, but I just figured it out. I set
every value in wordList to 'None' and so even if all the entry fields aren't
taken up, they go to '', so I can tell what is and what isn't taken up, and
get the string of the ones that are taken up.
Terry Reedy wrote:
>
>
>
> Alexnb wrote:
>> I am not sure what is going on here. Here is the code that is being run:
>>
>> def getWords(self):
>> self.n=0
>> for entry in self.listBuffer:
>> self.wordList[self.n] = entry.get()
>
> And what does self.wordList begin as? If {}, then the assignemt is
> invalid. Perhaps you want self.wordList.append(entry.get())
>
>> self.n=self.n+1
>
> Is this supposed to be incremented once per entry or once per
> getWords()? If the former, you would overwrite previous assignment (if
> it worked) for every item except the last.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
--
View this message in context: http://www.nabble.com/Problem-with-a-for-loop-and-a-list-tp18232298p18232688.html
Sent from the Python - python-list mailing list archive at Nabble.com.
More information about the Python-list
mailing list