On 3/16/11, tee chwee liong tc...@hotmail.com wrote:
hi,
i would like to know the time taken to execute a certain task in python. i
used time.time and time.clock and i see the time taken is different? what is
the right method to use?
import time
def testtime(num):
start=time.time()
Shane O'Connor, 17.03.2011 01:32:
In particular, I'm using Python 2.4.3 on a web server which needs to run as
fast as possible using as little memory as possible (no surprises there!).
Note that a web application involves many things outside of your own code
that seriously impact the
On Thu, Mar 17, 2011 at 8:45 AM, Stefan Behnel stefan...@behnel.de wrote:
Note that a web application involves many things outside of your own code
that seriously impact the performance and/or resource requirements. Database
access can be slow, excessively dynamic page generation and template
tee chwee liong tc...@hotmail.com wrote
i would like to know the time taken to execute a
certain task in python. i used time.time and time.clock
and i see the time taken is different?
what is the right method to use?
Neither of those, either use timeit() or the Python profiler.
They are
Bill Allen walle...@gmail.com wrote
I have found that for the Windows build of Python the msvcrt library
provides getch() and kbhit() functions. Is there a library
available for
the Linux Python build that provides the same or similar functions?
curses.
Take a look at the event handling
hi,
i used profiler. but it gives 0 sec? is this expected? tq
profile.run('import math')
3 function calls in 0.000 CPU seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
10.0000.0000.0000.000
On 16/03/2011 17:12, Susana Iraiis Delgado Rodriguez wrote:
Thank you for your help!
Once I read your comments I tried both corrections in my code, but none
of them we're sucessful.
Ok, Susana, your problem (here) is the use of the csv module
so can I suggest we back away from your wider
Profiling is really intended to profile a complex set of operations
not a single statement, for that timeit() would be a better choice.
However in this case, it may be that the time is so low it simply
doesn't register. Have you already imported math for example?
In which case you are
i wrote a code for extracting information from a csv file into another csv
file.
it worked well but i have an immediate challenge i can't seem to fix.
the new file that is created has an row and then an empty row and then a row
all through the file. how can i make the empty rows not be part of the
On 17/03/2011 11:56, Dipo Elegbede wrote:
i wrote a code for extracting information from a csv file into another
csv file.
it worked well but i have an immediate challenge i can't seem to fix.
the new file that is created has an row and then an empty row and then a
row all through the file. how
Thanks Tim, that worked like magic.
I now have another challenge on the same file, in this case, i am trying to
extract just a column as PARTY, I successfully wrote the header but instead
of having each element in a single excel block like this:
A
ACD
ACN
ACPN
AD
ADC
ALP
ANPP
APGA
APS
ARP
BNPP
On Thu, Mar 17, 2011 at 8:53 AM, Dipo Elegbede delegb...@dudupay.comwrote:
Thanks Tim, that worked like magic.
I now have another challenge on the same file, in this case, i am trying to
extract just a column as PARTY, I successfully wrote the header but instead
of having each element in a
The counter is there so that it limits the iteration to only the first rows,
i actually left it there because i used it earlier to print out specific
rows.
On Thu, Mar 17, 2011 at 2:04 PM, Joel Goldstick joel.goldst...@gmail.comwrote:
On Thu, Mar 17, 2011 at 8:53 AM, Dipo Elegbede
Alan,
Ah ha, ungetch(), that is what I was needing. I had be trying to simulate
kbhit() with getch() and keep being left with unhandled data in the buffer.
I had resorted to a trash=raw_input() to clear it.
Many thanks,
Bill
On Thu, Mar 17, 2011 at 04:01, Alan Gauld
I'm trying to run the below program and get it to print out feedback as the
loop goes. However, if you enter a number too high or too low, it skips the
print statement under the if and elif clauses and asks the user to Guess a
number between 1-100 again. Any suggestions on how to get it to print
Hi Jeff how are you today?
Well about your question... I copy and pasted your code and it worked fine for
me. Well except for in the code bit you posted you forgot to give a guess a
value before it was referred to. So under number = 44 I just wrote guess = 0
and
it worked fine.
But perhaps
On Thu, Mar 17, 2011 at 1:19 PM, Jeff Goodwin jeffbgood...@gmail.comwrote:
I'm trying to run the below program and get it to print out feedback as the
loop goes. However, if you enter a number too high or too low, it skips the
print statement under the if and elif clauses and asks the user to
On 3/17/2011 1:19 PM, Jeff Goodwin wrote:
I'm trying to run the below program and get it to print out feedback
as the loop goes. However, if you enter a number too high or too low,
it skips the print statement under the if and elif clauses and asks
the user to Guess a number between 1-100
Hi tutors!
I'm not a hard-core programmer but have used Python in systems
administration (it makes sense to me to use a scripting language which
supports both Windows and Unix).
The code below is an excerpt from a module I have written to collect
information about hosts on my network and
Only really glanced at this, but you seem to be checking only the last
thread *after* the loop? Surely you should be storing all the threads in a
list (or someplace) as you create them, and then check them all for liveness
and if so join them each in turn, to ensure you only print 'FINISHED'
Only really glanced at this, but you seem to be checking only the last
thread *after* the loop? Surely you should be storing all the threads in a
list (or someplace) as you create them, and then check them all for liveness
and if so join them each in turn, to ensure you only print 'FINISHED'
Shane O'Connor wrote:
Hi,
First-time poster here. I've a question about loop efficiency - I was
wondering whether this code:
i = 0
while i 1000:
do something
i+=1
is more efficient than:
for i in range(1000):
do something
or:
for i in xrange(1000):
do something
You can
22 matches
Mail list logo