Wow, this should be so simple, but it\' just not working. I need to inset a \"\\\" into a string (for a Bash command), but escaping just doesn\'t work.
>>&
If you want double slashes because the shell will escape \ again, use a raw string:
b = a[:3] + r'\\' + a[3:]