所以我试图允许我的用户在字符串中输入 \n 来指定新行。然而由于某种原因,它被翻译成“\\n”。所以我可以这样做:
inp = input().replace("\\n", "\n")
但这似乎有点麻烦;有没有更好的办法?
python newline input python-3.x
input ×1
newline ×1
python ×1
python-3.x ×1