| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 | 29 | 30 |
| 31 |
Tags
- import re
- time complexity
- level4
- LeetCode
- Stack
- lv4
- tableau
- itertools
- cte
- Growth hacking
- 코테
- AARRR
- collections
- 조합
- coding
- counter
- Level2
- sql
- lambda
- 코딩테스트
- Queue
- 파이썬
- programmers
- join
- coding test
- mysql
- 프로그래머스
- 완전탐색
- 코딩
- python
Archives
- Today
- Total
ror_coding
[Python] re (정규표현식) 본문
728x90
import re
- re.findall()
- re.sub()
import re
re.findall('\d+', data) # 숫자만 찾기. (결과는 list로 저장됨)
re.sub(r'\.+', '.', data) # '.'이 1개 이상일 때, '.'로 바꾸기.
= re.findall(r'[a-z0-9._-]', data) # 소문자, 숫자, ._- 만 찾기.
= re.findall(r'\d+[a-zA-Z][^\d\s]*', data) # 숫자, 문자와 특수문자 구별하여 찾기.
728x90
'Coding Test > Python' 카테고리의 다른 글
| [Programmers] 프로세스 - 42587 (0) | 2024.12.04 |
|---|---|
| [Programmers] 튜플 - 64065 (0) | 2024.12.04 |
| [Python] Permutations, Combination, Product (Itertools) (0) | 2024.12.04 |
| [Programmers] 피로도 - 87946 (3) | 2024.12.04 |
| [Programmers] 의상 - 42578 (2) | 2024.12.02 |