[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Simple question - end a raw string with a single backslash ?

On 2020-10-19, Stephen Tucker <stephen_tucker at> 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]