By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,767 Members | 1,114 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,767 IT Pros & Developers. It's quick & easy.

Re: Problem with a for loop and a list

P: n/a

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):
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.


View this message in context:
Sent from the Python - python-list mailing list archive at

Jul 2 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.