Python/python 기초

Escape Characters

DS지니 2021. 4. 2. 21:14
728x90
반응형

문제 > error (큰따옴표가 중복으로 사용됨)

txt = "We are the so-called "Vikings" from the north."

 

해결

txt = "We are the so-called \"Vikings\" from the north."
txt = 'We are the so-called "Vikings" from the north.'

 

 

* 그 외

\' Single Quote
\\ Backslash
\n New Line
\r Carriage Return
\t Tab
\b Backspace
\f Form Feed
\ooo Octal value
\xhh Hex value

www.w3schools.com/python/python_strings_escape.asp

 

728x90
반응형

'Python > python 기초' 카테고리의 다른 글

Operators 연산자  (0) 2021.04.02
Python Boolean 평가하기  (0) 2021.04.02
Format  (0) 2021.04.02
문자열 수정(Modify Strings)  (0) 2021.04.02
내장 데이터 유형 (Built-in Datatypes)  (0) 2021.04.02