Re: newbie ``print`` question

2012-09-02 Thread MRAB
On 03/09/2012 00:33, gwhite wrote: On Sep 2, 3:43 pm, MRAB wrote: On 02/09/2012 21:58, gwhite wrote: > On Sep 2, 1:16 pm, Dave Angel wrote: >> On 09/02/2012 03:50 PM, gwhite wrote: >> > On Sep 2, 12:43 pm, Dave Angel wrote: >> >> On 09/02/2012 03:34 PM, gwhite wrote: >> >>> >> >>> b

Re: newbie ``print`` question

2012-09-02 Thread gwhite
On Sep 2, 3:43 pm, MRAB wrote: > On 02/09/2012 21:58, gwhite wrote: > > > > > > > > > On Sep 2, 1:16 pm, Dave Angel wrote: > >> On 09/02/2012 03:50 PM, gwhite wrote: > > >> > On Sep 2, 12:43 pm, Dave Angel wrote: > >> >> On 09/02/2012 03:34 PM, gwhite wrote: > > >> >>> > >> >>> btw, I also thou

Re: newbie ``print`` question

2012-09-02 Thread Chris Angelico
On Mon, Sep 3, 2012 at 9:20 AM, gwhite wrote: > I guess you're saying 3.x will just ignore: > > from __future__ import print_function > > I'll risk being silly, and thus ask: but what if when I get to 3.x > there is no __future__, as it is now "present?" Do I need to strip > out the line? > > Wha

Re: newbie ``print`` question

2012-09-02 Thread gwhite
On Sep 2, 2:47 pm, Chris Angelico wrote: > On Mon, Sep 3, 2012 at 7:18 AM, gwhite wrote: > > Thanks again, Terry.  There is a lot to the language, I am finding > > out.  I am a HW engineer, not really a programmer.  Python seems a lot > > more sophisticated than MATLAB. > > > I'm kinda thinking `

Re: newbie ``print`` question

2012-09-02 Thread MRAB
On 02/09/2012 21:58, gwhite wrote: On Sep 2, 1:16 pm, Dave Angel wrote: On 09/02/2012 03:50 PM, gwhite wrote: > On Sep 2, 12:43 pm, Dave Angel wrote: >> On 09/02/2012 03:34 PM, gwhite wrote: >>> >>> btw, I also thought the default "add a CR LF" to the end was odd too. >>> But at lea

Re: newbie ``print`` question

2012-09-02 Thread Chris Angelico
On Mon, Sep 3, 2012 at 7:18 AM, gwhite wrote: > Thanks again, Terry. There is a lot to the language, I am finding > out. I am a HW engineer, not really a programmer. Python seems a lot > more sophisticated than MATLAB. > > I'm kinda thinking `write` is likely to be a little more "stable" than >

Re: newbie ``print`` question

2012-09-02 Thread gwhite
On Sep 2, 1:49 pm, Terry Reedy wrote: > On 9/2/2012 3:26 PM, gwhite wrote: > > > On the "rework" thing, yes, I suppose I could construct the line as a > > single string prior to print.    There would be things like `for` > > loops and conditionals to do so.  That isn't so unusual. > > The usual id

Re: newbie ``print`` question

2012-09-02 Thread gwhite
On Sep 2, 1:37 pm, Dennis Lee Bieber wrote: > On Sun, 2 Sep 2012 10:23:53 -0700 (PDT), gwhite > declaimed the following in gmane.comp.python.general: > > > > > "A space is written before each object is (converted and) written, > > unless the output system believes it is positioned at the beginnin

Re: newbie ``print`` question

2012-09-02 Thread gwhite
On Sep 2, 1:16 pm, Dave Angel wrote: > On 09/02/2012 03:50 PM, gwhite wrote: > > > > > > > > > > > On Sep 2, 12:43 pm, Dave Angel wrote: > >> On 09/02/2012 03:34 PM, gwhite wrote: > > >>> > >>> btw, I also thought the default "add a CR LF" to the end was odd too. > >>> But at least that one had

Re: newbie ``print`` question

2012-09-02 Thread Terry Reedy
On 9/2/2012 3:26 PM, gwhite wrote: On the "rework" thing, yes, I suppose I could construct the line as a single string prior to print.There would be things like `for` loops and conditionals to do so. That isn't so unusual. The usual idiom is to construct a list of pieces and then join wit

Re: newbie ``print`` question

2012-09-02 Thread Chris Rebert
On Sun, Sep 2, 2012 at 1:24 PM, Mark Lawrence wrote: > On 02/09/2012 20:58, me wrote: >> >> Well you can convert the ints to str then concatenate them. >> >> print "1" + "2" >> > > Please post other parts of the thread so people can get the context or don't > bother posting at all, thanks. Please

Re: newbie ``print`` question

2012-09-02 Thread Mark Lawrence
On 02/09/2012 20:58, me wrote: Well you can convert the ints to str then concatenate them. print "1" + "2" Please post other parts of the thread so people can get the context or don't bother posting at all, thanks. -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/pyth

Re: newbie ``print`` question

2012-09-02 Thread Dave Angel
On 09/02/2012 03:50 PM, gwhite wrote: > On Sep 2, 12:43 pm, Dave Angel wrote: >> On 09/02/2012 03:34 PM, gwhite wrote: >> >>> >>> btw, I also thought the default "add a CR LF" to the end was odd too. >>> But at least that one had a simple way out. >> But it (print on Python 2.x) doesn't, unless y

Re: newbie ``print`` question

2012-09-02 Thread gwhite
On Sep 2, 11:33 am, Terry Reedy wrote: > 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=

Re: newbie ``print`` question

2012-09-02 Thread me
Well you can convert the ints to str then concatenate them. print "1" + "2" -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie ``print`` question

2012-09-02 Thread gwhite
On Sep 2, 12:43 pm, Dave Angel wrote: > On 09/02/2012 03:34 PM, gwhite wrote: > > > > > > btw, I also thought the default "add a CR LF" to the end was odd too. > > But at least that one had a simple way out. > > But it (print on Python 2.x) doesn't, unless you're stuck on Windows. > And even then

Re: newbie ``print`` question

2012-09-02 Thread gwhite
On Sep 2, 10:45 am, Joel Goldstick wrote: > On Sun, Sep 2, 2012 at 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 > > > See the space in between the 1 and the 2 at the output print

Re: newbie ``print`` question

2012-09-02 Thread Dave Angel
On 09/02/2012 03:34 PM, gwhite wrote: > > > btw, I also thought the default "add a CR LF" to the end was odd too. > But at least that one had a simple way out. But it (print on Python 2.x) doesn't, unless you're stuck on Windows. And even then, you can prevent it by using a 'b' in the mode. --

Re: newbie ``print`` question

2012-09-02 Thread gwhite
On Sep 2, 12:26 pm, gwhite wrote: > On Sep 2, 10:55 am, Chris Rebert wrote: > > > > > > > > > > > On Sun, Sep 2, 2012 at 10:23 AM, 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 >

Re: newbie ``print`` question

2012-09-02 Thread gwhite
On Sep 2, 10:55 am, Chris Rebert wrote: > On Sun, Sep 2, 2012 at 10:23 AM, 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

Re: newbie ``print`` question

2012-09-02 Thread gwhite
On Sep 2, 11:33 am, Terry Reedy wrote: > 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=

Re: newbie ``print`` question

2012-09-02 Thread gwhite
On Sep 2, 10:55 am, Chris Rebert wrote: > On Sun, Sep 2, 2012 at 10:23 AM, 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

Re: newbie ``print`` question

2012-09-02 Thread gwhite
On Sep 2, 10:49 am, mblume wrote: > Am Sun, 02 Sep 2012 10:23:53 -0700 schrieb gwhite: > > > > > > > > > > > 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 th

Re: newbie ``print`` question

2012-09-02 Thread Terry Reedy
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,

Re: newbie ``print`` question

2012-09-02 Thread Chris Rebert
On Sun, Sep 2, 2012 at 10:23 AM, 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:

Re: newbie ``print`` question

2012-09-02 Thread mblume
Am Sun, 02 Sep 2012 10:23:53 -0700 schrieb gwhite: > 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 pri

Re: newbie ``print`` question

2012-09-02 Thread Joel Goldstick
On Sun, Sep 2, 2012 at 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 > > See the space in between the 1 and the 2 at the output print to the > command console? > > The help for print is: >

Re: newbie ``print`` question

2012-09-02 Thread Mark Lawrence
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 e

newbie ``print`` question

2012-09-02 Thread gwhite
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) writt

Re: Newbie: Print question

2006-03-22 Thread Tommy Grav
Thanks. That works. Like I said I am a newbie :)Cheers  TommyOn Mar 22, 2006, at 1:17 PM, Fredrik Lundh wrote:Tommy Grav wrote:      for testobs in obslist:         print testobs.printmpc() print.      def printmpc(self):         if self.mag!="":             print "%14s  %12.5f  %5.2f  %6.2f  %8.3f

Re: Newbie: Print question

2006-03-22 Thread xkenneth
doesnt look like you're passing any data to the print statement, shouldn't it be something like print '%d' % 4 output: 4\n -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: Print question

2006-03-22 Thread Fredrik Lundh
Tommy Grav wrote: > for testobs in obslist: > print testobs.printmpc() print. > def printmpc(self): > if self.mag!="": > print "%14s %12.5f %5.2f %6.2f %8.3f %3i" and print. > I don't understand where these None's are coming from. for each testobs

Newbie: Print question

2006-03-22 Thread Tommy Grav
Being new to Python I am getting a result I do not understand.I have a code that reads in a set of lines from a file, slits upthe lines and puts information into a list of class objects.    obslist = mpc.Read_Observations(options.in_fname) ;        for testobs in obslist:        print testobs.print