I am trying to print a result for example:
for record in result:
print varone,vartwo,varthree
I am trying to concatenate the variables which are from an SQL query, but I am getting whitespace. How can I strip whitespace from a ‘print’? Should I feed the result into a variable then do a ‘strip(newvar)’ then print the ‘newvar’?
This:
will replace the first
%sin the quotes with the value invarone, the second%swith the contents ofvartwo, etc.EDIT:
As of Python 2.6 you should prefer this method:
(Thanks Space_C0wb0y)