In the above example text, whitespace that was put there by the "enter" or "tab" keys should be allowed, but escape characters are not. Therefore, the pathname should be name.
I expect the first newline right after the opening quote to be a different byte code than the '\n'. But, they both are 10 and I don't know how to differentiate them. I was also surprised the first time I realized '\n' is a single byte and not '' + 'n'.
You are confusing reading from a stream with string literal syntax.
In a string literal, escape sequences are replaced by their interpretation, so the character sequence \n in a steing literal becomes the newline character (a single byte). There is no way to differentiate it based on the contents of the resulting string.
When you are reading from a stream (eg. stdin), then whatever you key in to the console will be literally put into the returned string. Escape sequences are not interpreted, as this is not the context of a string literal. This is what the quoted explanation refers to.
Thanks for the quick response, and I'm glad it's just me getting it confused. I've written all my tests using the b"..." syntax to test "input". How can I change these input strings to more accurately represent real input? is that what the raw string syntax would do, `r"..."?
The '\t' and '\n' are then prefixed with the additional ''. The only exception is the starting tab, which is just because I have VS Code set to use spaces instead of tabs, so they actually are spaces in the source.
Oh yeah if you want to type literal escape sequences into the string and not have them replaced you can use raw string literals, or escape the backslash