473,560 Members | 2,918 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1613
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.writ e('.')

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********@yah oo.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
2892
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: $Revision: 0.0 $
2
2612
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, i.e. positions in cm, sizes in pt. Apparently IE (in this case only IE is used for viewing/printing) makes sure not to print half lines, if a...
6
3311
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 parameter query which is the recordsource for the report. The parameter is <=. The query returns the correct amounts upto the date entered (no need for...
7
5372
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
3218
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 approach? vector<vector<int> > data; // already filled up properly with integers vector<int> result; // temp space
4
3261
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. (Like a space character.) The usual solution offered is to remove any whitespace in the code, like this:
3
1494
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? #include <stdio.h> #include <stdlib.h> /*---data type---*/ typedef int type; /*---------------*/
15
9000
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, &endptr, 10); printf("errno=%d\n", errno);
11
1374
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 old one. i thought what happend inside a function stays inside a function meaning what comes out is independent of what comes in. Meaning if I want...
0
7632
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7552
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8066
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7920
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5458
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5175
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3605
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2047
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.