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 "/Users/Username/Python_modules/lengthc
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 length
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
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
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 f
On Sun, Dec 25, 2011 at 6:00 AM, Lie Ryan 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 glob
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 increm
On Sun, Dec 25, 2011 at 5:18 AM, daedae11 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() function,
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 va