Alexnb a écrit :
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()
self.n=self.n+1
print self.wordList
def get_words(self):
Alexnb wrote:
> well okay, so what can I do?
>
>
>
Firstly, stop top posting. Replies to a thread "flow" better if bottom
posted.
Secondly, it sounds like you want to build a list of the results from
your entry.get() calls.
Try this:
self.wordList = []
def getWords(self):
for entry in se
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
The value of self.n only makes sense within the method, so you better use
the local variable n instead of the instance attribute self.n
> for entry in s
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-tp18232298p18232
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. Per
> x = [1]
>>>> x[2] = 4
> Traceback (most recent call last):
> File "", line 1, in ?
> IndexError: list assignment index out of range
>
>
> Albert
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
--
View this message in conte
On 2008-07-02, Alexnb <[EMAIL PROTECTED]> wrote:
> I have no idea what "list assignment index out of range means?!?!
You are assigning a value to a non-existing list element, as in
>>> x = [1]
>>> x[2] = 4
Traceback (most recent call last):
File "", line 1, in ?
IndexError: list assignment in
ange
I have no idea what "list assignment index out of range means?!?!
--
View this message in context:
http://www.nabble.com/Problem-with-a-for-loop-and-a-list-tp18232298p18232298.html
Sent from the Python - python-list mailing list archive at Nabble.com.
--
http://mail.python.org/mailman/listinfo/python-list