3 ms·
What version of python are you using. With python 3.8.5 1. \h doesn't get interpolated to anything (unlike \a, \b, \f, etc...) "\h" '\\h' "\a"
by ghshephard 6y ago
What version of python are you using. With python 3.8.5
1. \h doesn't get interpolated to anything (unlike \a, \b, \f, etc...)
"\h"
'\\h'
"\a"
'\x07'
2. The "r" needs to be in the original definition, not the f-string.
blah = r"\a"
You only need the "r" in the f-string if you don't want interpoolation of the "\" - I.e.:
fr" this\a {blah}"
'This\\a \\a
- lightlyused 6y agoThis was just an example to show what it does, I normally wouldn't have \h in a string. I use this to store lists of regular expressions in aws dynamodb list type and to convert them back to raw strings when used.