티스토리 뷰
s = 'C:\Users\Name\Folder'
와 같이 s라는 일반 string(normal string) 앞에 r 또는 R을 붙여 raw string을 만들 수 있다.
raw_s = r"C:\Users\Name\Folder"
raw string은 '\' (백슬래시)로 인해 특별한 문자열로 인식되는 '\n', '\t', '\U' 등과 같은 문자열을 글자 그대로의 문자열로 인식하도록 한다. 아래는 Python 공식 홈페이지의 설명이다.
: Both string and bytes literals may optionally be prefixed with a letter 'r' or 'R'; such strings are called raw strings and treat backslashes as literal characters. As a result, in string literals, '\U' and '\u' escapes in raw strings are not treated specially.
참고
반응형
'기술(Tech, IT) > 파이썬(Python)' 카테고리의 다른 글
[Tech, Python] re.compile() (0) | 2024.03.08 |
---|---|
[Tech, Python] re.escape (0) | 2024.03.02 |
[Python] SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape (0) | 2024.01.06 |
[Python] pickle (0) | 2023.12.28 |
[Python] 링크드 리스트 구현 - 1 (Singly Linked List) (0) | 2023.10.14 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- socket programming
- The Economist
- Computer Graphics
- 안드로이드
- ml
- 머신 러닝
- 딕셔너리
- 소켓 프로그래밍
- min heap
- vertex shader
- 티스토리챌린지
- 파이썬
- defaultdict
- 오블완
- The Economist Espresso
- Android
- C++
- Python
- java
- 이코노미스트 에스프레소
- tf-idf
- 투 포인터
- 리트코드
- leetcode
- DICTIONARY
- Hash Map
- I2C
- machine learning
- 이코노미스트
- join
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함
반응형