How can i apply raw string notation on input from the user? For exmple, i want to get path from the user and enforce raw string notation on it, so if the input is something like: "\path\the\user\chose" it will be accepted to the raw input / be converted later to r"\path\the\user\chose"
- 8Raw string notation is only for writing literals -- if you accept user input with backslashes in it, they will behave fine. No "conversion" is necessary.tzaman– tzaman2016-10-14 09:02:25 +00:00Commented Oct 14, 2016 at 9:02
- Possible duplicate of What exactly do "u" and "r" string flags do in Python, and what are raw string literals?tzaman– tzaman2016-10-14 09:03:45 +00:00Commented Oct 14, 2016 at 9:03
- @LironCohen Could you demonstrate how getting user input containing backslashes does not work?Biffen– Biffen2016-10-14 09:40:03 +00:00Commented Oct 14, 2016 at 9:40
Add a comment |