일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- import re
- programmers
- join
- 코딩
- Level2
- cte
- Queue
- 연습문제
- 코테
- 시간복잡도
- 파이썬
- 조합
- collections
- sql
- itertools
- mysql
- 완전탐색
- level4
- python
- Stack
- lv4
- 코딩테스트
- BFS
- coding
- time complexity
- 데이터분석
- counter
- coding test
- 프로그래머스
- lambda
- 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
'Algorithm > 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 |