473,228 Members | 1,792 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,228 software developers and data experts.

doing successive prints without space in between

I'd like to print a series of successive periods as a
progress status in a command line script using python.
Unforutnately, if I do a series of successive

print ".",

I get a space in between. Is there any way to avoid
this?
Jul 18 '05 #1
3 1594
Jon Perez wrote:
I'd like to print a series of successive periods as a
progress status in a command line script using python.
Unforutnately, if I do a series of successive

print ".",

I get a space in between. Is there any way to avoid
this?


import sys

sys.stdout.write('.')

The print command sends its output to sys.stdout (which you can
customize, by the way, by replacing sys.stdout with an instance of
a class containing a 'write' method; see
http://docs.python.org/lib/module-sys.html)

Dave

--
Dave Kuhlman
http://www.rexx.com/~dkuhlman
Jul 18 '05 #2
Jon Perez said unto the world upon 02/07/2004 16:00:
I'd like to print a series of successive periods as a
progress status in a command line script using python.
Unforutnately, if I do a series of successive

print ".",

I get a space in between. Is there any way to avoid
this?


Hi,

mid-June there was a thread "Printing a progress bar" on the Tutor list
that might be of interest to you.

Best,

Brian vdB

Jul 18 '05 #3
Jon Perez <jb********@yahoo.com> writes:
I'd like to print a series of successive periods as a
progress status in a command line script using python.
Unforutnately, if I do a series of successive

print ".",

I get a space in between. Is there any way to avoid
this?


This show up regularly and might be a FAQ. The print is trying to
help you out. If you want total control, go to the lower levels:

wr=sys.stdout #redirect as desired

def myprint(txt):
wr.write(txt) #raw print
wr.flush() #flush the dots as they occur

for i in range(100):
do_something()
myprint('.')

myprint('\n')

--
ha************@boeing.com
6-6M21 BCA CompArch Design Engineering
Phone: (425) 342-0007
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Marcin Ciura | last post by:
Here is a pre-PEP about print that I wrote recently. Please let me know what is the community's opinion on it. Cheers, Marcin PEP: XXX Title: Print Without Intervening Space Version:...
2
by: André Hänsel | last post by:
Hi! I compared the printed results of two of my pages. One is a very old page, "styled" almost without any CSS. The other one is a modern page, styled completely in CSS and styled for printing,...
6
by: Mike Conklin | last post by:
This one really has me going. Probably something silly. I'm using dcount for a report to determine the number of different types of tests proctored in a semester. My report is based on a...
7
by: Prashanth Badabagni | last post by:
Hi , I'm Prashanth Badabagni .. I have and idea how a program prints it's own source code .. void main() { FILE *P; char *file,c; strcpy(file,__FILE__); p=fopen(file,"r");
1
by: Digital Puer | last post by:
I would like to merge together several STL integer vectors using STL's merge() function. What is the best way to do this while avoiding unnecessary vector copying? Is the following a good...
4
by: blaq | last post by:
When one encounters mysterious gaps between elements, like: <div> <img src="one.gif"> <img src="two.gif"> </div> it's typically because the browser renders whitespace in the code as text....
3
by: Franco Perilli | last post by:
I've compiled this code and no problems, but when I run the program, it prints only the last entry i've inserted. Looks like a problem in the sorted insertion algorithm. Can u help me plz? ...
15
by: robert maas, see http://tinyurl.com/uh3t | last post by:
Here's the source: #include <stdio.h> #include <errno.h> main () { char* str = "9999999999"; long long int llin; char* endptr; /* Set by strtoll */ int nch; errno = 0; llin = strtoll(str,...
11
by: ssecorp | last post by:
I am never redefining the or reassigning the list when using validate but since it spits the modified list back out that somehow means that the modified list is part of the environment and not the...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.