Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28287

Re: newbie ``print`` question

From Terry Reedy <tjreedy@udel.edu>
Subject Re: newbie ``print`` question
Date 2012-09-02 14:33 -0400
References <c9b2c268-fcc4-40f7-8769-517c13683894@v9g2000pbu.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.99.1346610805.27098.python-list@python.org> (permalink)

Show all headers | View raw


On 9/2/2012 1:23 PM, 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

You have discovered why print is a function in 3.x.
 >>> print(1, 2, sep='')
12
 >>> print(1, end=''); print(2, end='')
12

In 2.6 or 2.7, you can add
   from __future__ import print_function
but I recommend using 3.2 or 3.3 unless you have a reason to use older 
Python.



-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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