원문 : http://learnpythonthehardway.org/book/ex10.html
이스케이프 시퀀스 (Escape Sequence)에 대해서 알아보자 (ex10.py)
tabby_cat = "\tI'm tabbed in." persian_cat = "I'm split\non a line." backslash_cat = "I'm \\ a \\ cat." fat_cat = """ I'll do a list: \t* Cat food \t* Fishies \t* Catnip\n\t* Grass """ print tabby_cat print persian_cat print backslash_cat print fat_cat
결과
알 수 있는 내용...
1. 탭, 줄 바꿈 과 같은 특수문자(?)를 표현할 때는 escape sequence를 사용한다.
2. Escape Sequences (http://learnpythonthehardway.org/book/ex10.html 참고)
Escape |
What it does |
\\ |
Backslash () |
\' |
Single-quote (') |
\" |
Double-quote (") |
\a |
ASCII bell (BEL) |
\b |
ASCII backspace (BS) |
\f |
ASCII formfeed (FF) |
\n |
ASCII linefeed (LF) |
\N{name} |
Character named name in the Unicode database (Unicode only) |
\r ASCII |
Carriage Return (CR) |
\t ASCII |
Horizontal Tab (TAB) |
\uxxxx |
Character with 16-bit hex value xxxx (Unicode only) |
\Uxxxxxxxx |
Character with 32-bit hex value xxxxxxxx (Unicode only) |
\v |
ASCII vertical tab (VT) |
\ooo |
Character with octal value ooo |
\xhh |
Character with hex value hh |
'Python > Python 어렵게 배우기' 카테고리의 다른 글
Python 어렵게 배우기 - Exercise 12: Prompting People (0) | 2013.11.28 |
---|---|
Python 어렵게 배우기 - Exercise 11: Asking Questions (0) | 2013.11.28 |
Python 어렵게 배우기 - Exercise 9: Printing, Printing, Printing (0) | 2013.11.21 |
Python 어렵게 배우기 - Exercise 8: Printing, Printing (0) | 2013.11.21 |
Python 어렵게 배우기 - Exercise 7: More Printing (0) | 2013.11.21 |