I am using Python 3.5 and PyCharm 2017.3
My code appears as following:
var1 = 'ASD'
var2 = 'ASDPO'
qryPwr = ''.join(['select DATE as "DATE"'
' from Table1 where MKT = ', "'", var1, "'",
' and COMP = ', "'", var2, "'",
' and ppow_vdays = 0'
' and PPOW_SETTLE = ', "'", 'S', "'"])
I get the following for qryPqr:
qryPwr
'select DATE as "DATE", from Table1 where MKT = \'ASD\' and COMP = \'ASDPO\' and ppow_vdays = 0 and PPOW_SETTLE = \'S\''
So, I have two questions:
(1) Why are there backslashes everywhere?
(2) How do I get rid of them or make my join statement better?
Edit:
I want to remove the backslashes from the print statement as when I do the database query using qryPwr it tries to run the query with backslashes and hence errors out.
print qryPwrto see how the characters are printed - the backlashes are part of special symbols ('mostly in your case), and would also appear for any line breaks or tabs (\nand\trespectively). See this tutorial for more information.