many of the findings are for python2, my case is python3:
I need to replace double back slash to single back slash
a = 'RXIE-SERVER\\MSSQLSERVER_NEW'
An "accepted answer" from this post python3 replacing double backslash with single backslash doesn't work here:
So what is the problem here? Thank you very much.
[UPDATE]:
Thanks to @ShadowRanger's reply, so if print the string after the replace operation, it is working expected, however, in my case I need to concat the post-replacement to generate another variable (conn_str), as you can see, it is still showing double backslash.
Any clue for a workaround?
Thank you very much.
server = str.replace(data['server'], "\\\\", "\\")
database = data['database']
driver = data['driver']
auth = data['auth']
conn_str = "DRIVER={" + driver + "}; SERVER=" + server + "; Database=" + database + ";" + auth