newbie ``print`` question

gwhite gwhite at ti.com
Sun Sep 2 15:50:12 EDT 2012


On Sep 2, 12:43 pm, Dave Angel <d... at davea.name> wrote:
> On 09/02/2012 03:34 PM, gwhite wrote:
>
> > <snip>
>
> > 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.

Yes, I'm using windows.  What is "'b' in the mode?"  The help for
print says:

A ``'\n'`` character is written at the end, unless the ``print``
statement ends with a comma.  This is the only action if the statement
contains just the keyword ``print``.

So I followed with a comma to stop the default CR LF insertion.




More information about the Python-list mailing list