I am using Python 3 and am trying to use my print statements with the str.format.
e.g:
print ('{0:3d} {1:6d} {2:10s} '.format (count1,count2,string1))
When I try to use the end=''
to suppress the subsequent newline, this is ignored. A newline always happens.
How do I suppress the subsequent newline?
Source:
int1= 1
int2 = 999
string1 = 'qwerty'
print ( '{0:3d} {1:6d} {2:10s} '.format (int1,int2,string1))
print ('newline')
print ( '{0:3d} {1:6d} {2:10s} '.format (int1,int2,string1,end=''))
print ('newline')
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "copyright", "credits" or "license()" for more information.
1 999 qwerty
newline1 999 qwerty
newline