python print and whitespace -


i trying print result example:

for record in result:     print varone,vartwo,varthree 

i trying concatenate variables sql query, getting whitespace. how can strip whitespace 'print'? should feed result variable 'strip(newvar)' print 'newvar'?

this:

print "%s%s%s" % (varone,vartwo,varthree) 

will replace first %s in quotes value in varone, second %s contents of vartwo, etc.

edit:
of python 2.6 should prefer method:

print "{0}{1}{2}".format(varone,vartwo,varthree) 

(thanks space_c0wb0y)


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -