Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #28279
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Subject | Re: newbie ``print`` question |
| Date | 2012-09-02 18:41 +0100 |
| References | <c9b2c268-fcc4-40f7-8769-517c13683894@v9g2000pbu.googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.93.1346607672.27098.python-list@python.org> (permalink) |
On 02/09/2012 18:23, gwhite wrote:
> I can't figure out how to stop the "add a space at the beginning"
> behavior of the print function.
>
>>>> print 1,;print 2,
> 1 2
>
> See the space in between the 1 and the 2 at the output print to the
> command console?
>
> The help for print is:
>
> "A space is written before each object is (converted and) written,
> unless the output system believes it is positioned at the beginning of
> a line."
>
> So it is apparently doing what it is supposed to do.
>
> Is there a way to stop this? Or is there a different function that
> will only print what you have in the formatted string?
>
> For example, in MATLAB I only had to do:
>
>>> fprintf('1');fprintf('2')
> 12
>
> fprintf works the same way if printing to a file. It only puts in
> what you explicitly tell it to put in.
>
I'd settle for print 12, YMMV.
--
Cheers.
Mark Lawrence.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
newbie ``print`` question gwhite <gwhite@ti.com> - 2012-09-02 10:23 -0700
Re: newbie ``print`` question Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-02 18:41 +0100
Re: newbie ``print`` question Joel Goldstick <joel.goldstick@gmail.com> - 2012-09-02 13:44 -0400
Re: newbie ``print`` question gwhite <gwhite@ti.com> - 2012-09-02 12:46 -0700
Re: newbie ``print`` question mblume <foobar@invalid.invalid> - 2012-09-02 17:49 +0000
Re: newbie ``print`` question gwhite <gwhite@ti.com> - 2012-09-02 11:51 -0700
Re: newbie ``print`` question Chris Rebert <clp2@rebertia.com> - 2012-09-02 10:55 -0700
Re: newbie ``print`` question gwhite <gwhite@ti.com> - 2012-09-02 11:51 -0700
Re: newbie ``print`` question gwhite <gwhite@ti.com> - 2012-09-02 12:26 -0700
Re: newbie ``print`` question gwhite <gwhite@ti.com> - 2012-09-02 12:34 -0700
Re: newbie ``print`` question Dave Angel <d@davea.name> - 2012-09-02 15:41 -0400
Re: newbie ``print`` question gwhite <gwhite@ti.com> - 2012-09-02 12:50 -0700
Re: newbie ``print`` question Dave Angel <d@davea.name> - 2012-09-02 16:15 -0400
Re: newbie ``print`` question gwhite <gwhite@ti.com> - 2012-09-02 13:58 -0700
Re: newbie ``print`` question MRAB <python@mrabarnett.plus.com> - 2012-09-02 23:43 +0100
Re: newbie ``print`` question gwhite <gwhite@ti.com> - 2012-09-02 16:33 -0700
Re: newbie ``print`` question MRAB <python@mrabarnett.plus.com> - 2012-09-03 01:12 +0100
Re: newbie ``print`` question Terry Reedy <tjreedy@udel.edu> - 2012-09-02 16:49 -0400
Re: newbie ``print`` question gwhite <gwhite@ti.com> - 2012-09-02 14:18 -0700
Re: newbie ``print`` question Chris Angelico <rosuav@gmail.com> - 2012-09-03 07:47 +1000
Re: newbie ``print`` question gwhite <gwhite@ti.com> - 2012-09-02 16:20 -0700
Re: newbie ``print`` question Chris Angelico <rosuav@gmail.com> - 2012-09-03 09:28 +1000
Re: newbie ``print`` question Terry Reedy <tjreedy@udel.edu> - 2012-09-02 14:33 -0400
Re: newbie ``print`` question gwhite <gwhite@ti.com> - 2012-09-02 12:18 -0700
Re: newbie ``print`` question Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-02 16:37 -0400
Re: newbie ``print`` question gwhite <gwhite@ti.com> - 2012-09-02 14:04 -0700
csiph-web