AK wrote:
import time, sys
print "ONE",
sys.stdout.flush()
time.sleep(0.5)
print "\rTWO",
sys.stdout.flush()
time.sleep(0.5)
Running the command above prints out
ONE
TWO
but running
for i in range(10):
print "ONE",
time.sleep(0.2)
prints out
ONE ONE ONE ONE ONE ONE ONE ONE ONE ONE
Mel wrote:
Joel Ross wrote:
Rhodri James wrote:
[ ... ]
Except that you still have the interesting issue that your environment
isn't responding to '\r' correctly, which worries me rather. Or did
you never test that?
Yeah I gave the "\r" a go and it kept printing
Dennis Lee Bieber wrote:
flush() is working perfectly fine -- it says transmit any data still
held within internal buffers. It is NOT a "clear screen", "clear line"
terminal command.
I was mistaken about the sys.stout.flush(). I understand it a little
more now thanks
--
http://mail.py
Rhodri James wrote:
On Sat, 23 May 2009 18:19:11 +0100, Joel Ross wrote:
Now I can move onto next one.
Except that you still have the interesting issue that your environment
isn't responding to '\r' correctly, which worries me rather. Or did
you never test that?
Yeah I gav
Thanks for all the help guys. I got it to work correctly with this
class progress:
def __init__(self):
self.already = 0
def progressbar(self, number, total, char):
percentage = int(100 - round(number*100.0/total))
if percentage > 0:
xchar = char * (perc
Carl Banks wrote:
On May 23, 3:49 am, Joel Ross wrote:
def progressbar(self, number, total, char):
percentage = float(number*100)/total
percentage = int(round(percentage))
percentage = int(100 - percentage)
self.f=sys.stdout
if percentage >
Carl Banks wrote:
On May 23, 2:20 am, Joel Ross wrote:
Carl Banks wrote:
On May 22, 10:33 pm, Joel Ross wrote:
Hi all,
I'm using python 2.5 and trying to flush the sys.stout buffer with
sys.stout.flush(), but doesn't seem to work. Each time a line is printed
it appends the one
Carl Banks wrote:
On May 22, 10:33 pm, Joel Ross wrote:
Hi all,
I'm using python 2.5 and trying to flush the sys.stout buffer with
sys.stout.flush(), but doesn't seem to work. Each time a line is printed
it appends the one before it I need to clear the output and write a
new outp
Hi all,
I'm using python 2.5 and trying to flush the sys.stout buffer with
sys.stout.flush(), but doesn't seem to work. Each time a line is printed
it appends the one before it I need to clear the output and write a
new output without appending the previous one. I have tried the -u
(unbuffe
Dave Angel wrote:
Tim Wintle wrote:
On Fri, 2009-05-22 at 13:19 +0200, Andre Engels wrote:
number/total = 998/999 = 0
number/total*100 = 0*100 = 0
float(number/total*100) = float(0) = 0.0
Change "float(number/total*100)" to "float(number)/total*100" and it
should work:
I'd use:
(n
Andre Engels wrote:
On Fri, May 22, 2009 at 12:35 PM, Joel Ross wrote:
Im using 2.6 python and when running this
class progess():
def __init__(self, number, total, char):
percentage = float(number/total*100)
percentage = int(round(percentage))
char = char
Andre Engels wrote:
On Fri, May 22, 2009 at 11:17 AM, Joel Ross wrote:
Hi all,
I have this piece of code
class progess():
def __init__(self, number, char):
total = number
percentage = number
while percentage > 0 :
percentage = int(number/total*
Joel Ross wrote:
Hi all,
I have this piece of code
class progess():
def __init__(self, number, char):
total = number
percentage = number
while percentage > 0 :
percentage = int(number/total*100)
number-=1
c
Hi all,
I have this piece of code
class progess():
def __init__(self, number, char):
total = number
percentage = number
while percentage > 0 :
percentage = int(number/total*100)
number-=1
char+="*"
print char
progess
Joel Ross wrote:
Hi all,
I have this piece of code:
#
wordList = "/tmp/Wordlist"
file = open(wordList, 'r+b')
def readLines():
for line in file.read():
if not line: break
Steven D'Aprano wrote:
On Wed, 11 Feb 2009 18:52:40 +1100, Joel Ross wrote:
Thanks for the quick response guys. Help me out a alot. I'm a newbie to
python and your replies help me understand a bit more about python!!
Joel, unless you have Guido's time machine and are actual
Joel Ross wrote:
Hi all,
I have this piece of code:
#
wordList = "/tmp/Wordlist"
file = open(wordList, 'r+b')
def readLines():
for line in file.read():
if not line: break
Hi all,
I have this piece of code:
#
wordList = "/tmp/Wordlist"
file = open(wordList, 'r+b')
def readLines():
for line in file.read():
if not line: break
print line + '.com '
re
18 matches
Mail list logo