Samuel wrote:
>Hello,
>
>I have been searching for an answer for almost two hours now and have
>not found an answer. I want this code:
>
>for i in range(3):
> print i # or whatever
>
>To produce this output:
>012
>
>How can I print a word without appending a newline character? Appending
>a ","
Thanks for your help, Guys. This works of course.
-Samuel
--
http://mail.python.org/mailman/listinfo/python-list
Johnny Lee enlightened us with:
> Why the prompt followed after the output? Maybe it's not as
> expected.
Because it did what you ask of it: write "012" to stdout, and nothing
else. Hence, no newline at the end, hence the prompt is on the same
line.
Sybren
--
The problem with the world is stupid
Johnny Lee wrote:
> Roy Smith wrote:
>
>>For closer control over output, use the write() function. You want
>>something like:
>>
>>import sys
>>for i in range(3):
>> sys.stdout.write (str(i))
>
>
> here is the output of my machine:
>
> >>> import sys
> >>> for i in range(3):
> ... sys
Roy Smith wrote:
>
> For closer control over output, use the write() function. You want
> something like:
>
> import sys
> for i in range(3):
>sys.stdout.write (str(i))
here is the output of my machine:
>>> import sys
>>> for i in range(3):
... sys.stdout.write(str(i))
...
012>>>
On Thu, 2005-09-15 at 17:37 -0700, Samuel wrote:
> Hello,
>
> I have been searching for an answer for almost two hours now and have
> not found an answer. I want this code:
>
> for i in range(3):
> print i # or whatever
>
> To produce this output:
> 012
>
> How can I print a word without ap
In article <[EMAIL PROTECTED]>,
"Samuel" <[EMAIL PROTECTED]> wrote:
> How can I print a word without appending a newline character? Appending
> a "," to the print statement only substitutes the newline for a space,
> which is not what I am looking for.
For closer control over output, use the wr
Samuel wrote:
> How can I print a word without appending a newline character? Appending
> a "," to the print statement only substitutes the newline for a space,
> which is not what I am looking for.
Use sys.stdout.write directly.
--
Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.co
Hello,
I have been searching for an answer for almost two hours now and have
not found an answer. I want this code:
for i in range(3):
print i # or whatever
To produce this output:
012
How can I print a word without appending a newline character? Appending
a "," to the print statement only