The following program has an error :
new += lists[int(j)]+-;
UnboundLocalError: local variable 'new' referenced before assignment
But when I put the sentence new = '' in the main() function, the program
run normally.
Please tell me why? Isn't
On Sun, Dec 25, 2011 at 5:18 AM, daedae11 daeda...@126.com wrote:
The following program has an error :
new += lists[int(j)]+-;
UnboundLocalError: local variable 'new' referenced before assignment
But when I put the sentence new = '' in the main()
On 12/25/2011 09:46 PM, Joel Goldstick wrote:
You can either move the stuff at the top of your program into main, or
you could pass the outer new
into main as a parameter:main(new):
the third alternative is to use the global keyword, e.g.
# declare a global named 'new'
new = 0
def
On Sun, Dec 25, 2011 at 6:00 AM, Lie Ryan lie.1...@gmail.com wrote:
On 12/25/2011 09:46 PM, Joel Goldstick wrote:
You can either move the stuff at the top of your program into main, or
you could pass the outer new
into main as a parameter: main(new):
the third alternative is to use the
daedae11 wrote:
The build-in function reversed() in Python2.5 returns a iterator. But I don't
know how to use the iterator.
Please give me a simple example about how to use bulid-in function reversed()
to reverse a list.
You use the iterator the same way you would any other iterator:
* in
On 25/12/11 10:18, daedae11 wrote:
The following program has an error :
new += lists[int(j)]+-;
UnboundLocalError: local variable 'new' referenced before assignment
Others have answered the question for you however there are two
additional points to make:
1) Always send the complete erroir
On 12/24/2011 11:13 PM, Lie Ryan wrote:
Querying .lastrowid is pretty much safe as long as you don't use a
single cursor from multiple threads. The .lastrowid attribute belongs to
a cursor, so write operations from one cursor would not affect the
.lastrowid of other cursors.
However, note that
Hey there!
I'm reading Lutz's Learning Python.
Here is some code from the book.
There is a module called lcclient_lutz.py:
from lengthcounter_lutz import countLines, countChars
print countLines('lengthcounter_lutz.py'), countChars('lengthcounter_lutz.py')
And there is another one called
On 25/12/11 22:55, Stayvoid wrote:
There is a module called lcclient_lutz.py:
from lengthcounter_lutz import countLines, countChars
print countLines('lengthcounter_lutz.py'), countChars('lengthcounter_lutz.py')
countChars('lengthcounter_lutz.py')
File