[Tutor] Printing with no newline :(

Sarma Tangirala tvssarma.omega9 at gmail.com
Mon Nov 7 17:42:37 CET 2011


On 6 November 2011 21:09, Alan Gauld <alan.gauld at btinternet.com> wrote:

> On 06/11/11 10:23, Sarma Tangirala wrote:
>
>  I'm sorry. Didn't notice the python 3 part, I just joined the list and
>> did not look at the OPs post. Sorry about that.
>>
>
> welcome to the list :-)
>
>
>  Please bear with me on this, but does the following not print "end" for
>> every iteration of "items"?
>>
>> for item in items:
>>      print(item, end="")
>>
>
> No, end is a new optional parameter for the print function in Python 3.
> Recall that in Python2 print was a command whereas in Python 3 it is a
> function which has a couple of new options:
>
>
Thank you!


> ---------------
> Help on built-in function print in module builtins:
>
> print(...)
>    print(value, ..., sep=' ', end='\n', file=sys.stdout)
>
>    Prints the values to a stream, or to sys.stdout by default.
>    Optional keyword arguments:
>    file: a file-like object (stream); defaults to the current sys.stdout.
>    sep:  string inserted between values, default a space.
>    end:  string appended after the last value, default a newline.
>
>
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
>
> ______________________________**_________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/**mailman/listinfo/tutor<http://mail.python.org/mailman/listinfo/tutor>
>




-- 
Sarma Tangirala,
Class of 2012,
Department of Information Science and Technology,
College of Engineering Guindy - Anna University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111107/081dafae/attachment-0001.html>


More information about the Tutor mailing list