detrail the trailing space in print statement

June Kim junaftnoon at nospamplzyahoo.com
Sat Oct 21 17:33:31 EDT 2000


I'd searched the deja news archive for a couple of mins
and I found out the right answer. For other newbies'
information, I post it here.

Use sys.stdout.write, which will output the raw string per se.

Sorry if my posting wasted some space in the news servers.

-June

"June Kim" <junaftnoon at nospamplzyahoo.com> wrote in message
news:8st0m9$l15$1 at news.nuri.net...
> for i in (a list of a huge size):
>     do something quite complex
>     print f(i),
>     do something else
>
>
> In this code, what I really want to do is printing out "f(i)"
> as a stream. I can remove the newline character by
> adding a comma but cannot remove the trailing space
> which is automatically inserted at the end of the object.
> (adding up the f(i) objects in the loop, and outputting
> the whole stuff in one string out of the loop sounds not
> very good, 'cuz it will take up a large size of memory)
>
> Any comments?
>
>




More information about the Python-list mailing list