How do I keep Python print from adding newlines or spaces? [duplicate]

In python, if I say

print 'h'

I get the letter h and a newline. If I say

print 'h',

I get the letter h and no newline. If I say

print 'h',
print 'm',

I get the letter h, a space, and the letter m. How can I prevent Python from printing the space?

The print statements are different iterations of the same loop so I can’t just use the + operator.

15 Answers
15

Leave a Comment