printing - How do I keep Python print from adding newlines or spaces? -
this question has answer here:
- how print without newline or space? 26 answers
in python, if say
print 'h'
i letter h , newline. if
print 'h',
i letter h , no newline. if say
print 'h', print 'm',
i letter h, space, , letter m. how can prevent python printing space?
the print statements different iterations of same loop can't use + operator.
you can use:
sys.stdout.write('h') sys.stdout.write('m')
Comments
Post a Comment