일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- collections
- tableau
- counter
- sql
- Level2
- coding
- cte
- import re
- time complexity
- python
- 조합
- programmers
- itertools
- 프로그래머스
- level4
- 코딩
- Stack
- mysql
- lv4
- coding test
- 코테
- 파이썬
- Growth hacking
- AARRR
- LeetCode
- lambda
- 코딩테스트
- join
- 완전탐색
- Queue
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 |