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