3 ms·
This seems like an awesome feature. I wish Python had something like it.
by leephillips 10y ago
This seems like an awesome feature. I wish Python had something like it.
- masklinn 10y agoPython 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.)