• 카테고리

    질문 & 답변
  • 세부 분야

    프로그래밍 언어

  • 해결 여부

    미해결

탈출문자 \b에 관해 질문이 있습니다.

23.01.13 00:19 작성 조회수 189

0

print("Redd\bApple") << RedApple이 되는 것은 알겠는데요

시험삼아 print("Redd\b")를 출력했더니 Redd그대로 나오더라구요??

\b뒤에 어떤 문자열이 있어야 앞의 한 글자를 지울 수 있는 건가요??

답변 1

답변을 작성해보세요.

0

ddbass님의 프로필

ddbass

2023.12.07

Most of the escape sequences supported by Python string literals are also accepted by the regular expression parser:

\a      \b      \f      \n
\N      \r      \t      \u
\U      \v      \x      \\

(Note that \b is used to represent word boundaries, and means “backspace” only inside character classes.)


https://docs.python.org/3/library/re.html

위는 python 공식 사이트 library 에서 발췌했구요, backspace 를 뜻하는\b는 캐릭터 사이에 있을 때에만 되는게 맞는 것 같네요.