I have this string:
feed_\\d{6}.txt.gz
and I need to replace the double backslash with a single backslash. I have looked at other answers (including How to replace a double backslash with a single backslash in python?) but they haven't helped.
Here are things that don't work
mystr = 'feed_\\d{6}.txt.gz'
mystr.replace('\\', '\')
# invalid syntax. string is unterminated.
mystr.replace('\\\\', '\\')
#returns the original string
import codecs
codecs.escape_decode(mystr)
# returns a tuple ('feed_\\d{6}.txt.gz', 17)
# Got this from the aforementioned other thread but it doesn't
# actually explain how to use it
I'm stumped. Any ideas?