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
Post a Comment