自然字符串
r"Newlines are indicated by \n"
'Newlines are indicated by \\n'
上面加上自然字符串后,为什么会多了一个反斜杠?我觉得应该是
'Newlines are indicated by \n'这样才对啊?
[解决办法]
N
r会把所有字符都认为是单独的,包括'\'
[解决办法]
"Newlines are indicated by \n"中的"\n"代表回车
r"Newlines are indicated by \n"是将"\n"视为非转义字符
所以表示为"\\n"
[解决办法]
你输出一下len()就知道了