Bear with me I am new to Python. I wrote a simple script to parse a long string which contains multiple substrings wrapped in single quote. I used str.replace
to replace single quote to empty string. However input string is changed with double quote instead. I ran the script with new input by accident and in my surprise it still replaced all double quote to empty string.
I thought I read in somewhere in Python, double quote and single quote are treated same. Is that correct statement?
Update:
My apology. I must have confused others with this question including myself. I ran quick test script to verify the output what I saw from the original script however I don't see the same output. I tried to replace input string contains double quote (e.g. str="foo \"abc\" \"efg\""
with str.replace("'","")
but it didn't do. I had to re-examine the original script and input string it is trying to parse. Thank you for taking your time looking into this thread.
I just verified that part of the original script (rather long and a bit complex one by saying that I didn't tell the whole truth about this script in the context of my question, I am sorry about that) misled me to believe (for a while) Python str.replace
treat double and single quote in same manner which was wrong assumption.