Asked • 05/11/19

How to print without newline or space?

The question is in the title.I'd like to do it in [tag:Python]. What I'd like to do in this example in [tag:C]:<!-- language: lang-c --> #include <stdio.h> int main() { int i; for (i=0; i<10; i++) printf("."); return 0; }Output: ..........In Python: >>> for i in xrange(0,10): print '.' . . . . . . . . . . >>> for i in xrange(0,10): print '.', . . . . . . . . . .In Python `print` will add a `\\n` or a space, how can I avoid that? Now, it's just an example. Don't tell me I can first build a string then print it. I'd like to know how to "append" strings to `stdout`.

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.