473,406 Members | 2,549 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,406 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 1608
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.