Simple question - end a raw string with a single backslash ?
Grant Edwards
grant.b.edwards at gmail.com
Mon Oct 19 10:04:55 EDT 2020
On 2020-10-19, Stephen Tucker <stephen_tucker at sil.org> wrote:
> For a neatish way to get a string to end with a single backslash, how about
> mystr = r"abc\ "[:-1]
> (Note the space at the end of the rough-quoted string.)
That's the first thing I thought of, though I would probably use a
non-space character to avoid convusion when reading:
mystr = r'abc\_'[:-1]
--
Grant
More information about the Python-list
mailing list