3 ms·
Python has triple-quoted strings which generally do the trick, and uses prefixes for "non-standard" string behaviours (though it doesn't have a regex version II
by masklinn 10y ago
Python has triple-quoted strings which generally do the trick, and uses prefixes for "non-standard" string behaviours (though it doesn't have a regex version IIRC, Python 3.6 adds interpolation via f-strings)
str1 = f"""This is "my" string."""
str2 = """Auto-use of matching pairs"""
str3 = r"""/url/match/made/easy"""
- leephillips 10y agoYes, I've belatedly caught on to using triple-quotes to avoid some escaping. But I didn't know about the f-strings - thanks! (I'll be using those when I start using 3.6.)