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