[Tutor] Printing with no newline :(

Sarma Tangirala tvssarma.omega9 at gmail.com
Sun Nov 6 11:23:23 CET 2011


On 6 November 2011 15:47, Dave Angel <d at davea.name> wrote:

> On 11/06/2011 04:45 AM, Sarma Tangirala wrote:
>
>> On 6 November 2011 13:11, Peter Otten<__peter__ at web.de>  wrote:
>>
>>  Joe Batt wrote:
>>>
>>>  I am learning Python 3 and programming and am very new so please bear
>>>>
>>> <SNIP>
>>>
>>>  for item in items:
>>>>>>
>>>>> ...     print(item, end="WHATEVER")
>>>
>>>
>> Another way of writing the above.
>>
>> for i in items:
>>      print item[i], "whatever", "\n"
>>
>>
>>  Nope. That would put a newline between each iteration, which is
> explicitly what the OP did not want.  More importantly, it'd give a syntax
> error in Python 3, which the OP carefully specified.
>
> --
>
> DaveA
>
>

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.

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="")




-- 
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/20111106/25c61426/attachment.html>


More information about the Tutor mailing list