일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Python
- Redshift
- PostgreSQL
- list
- django
- string
- PySpark
- Apache
- c#
- PANDAS
- Google Spreadsheet
- GIT
- hive
- SQL
- Github
- dataframe
- Tkinter
- Google Excel
- numpy
- math
- 파이썬
- google apps script
- matplotlib
- Excel
- Java
- array
- Mac
- gas
- Kotlin
- Today
- Total
목록Pattern (2)
달나라 노트
Python re library의 findall method는 문자열 내에서 특정 패턴을 만족하는 모든 문자열을 return해줍니다. Syntax findall(pattern, text) - pattern 찾을 문자열의 pattern을 입력하는 부분입니다. - text 문자열을 찾을 대상 텍스트를 의미합니다. 정리해보면 text에서 pattern과 일치하는 부분을 모두 찾아 return해주는 것이 findall method의 기능이라고 볼 수 있습니다. import re str_text = 'apple_banana' list_result = re.findall(r'apple', str_text) print(list_result) -- Result ['apple'] 위 코드는 apple_banana 라는 ..
re.serach method는 다음과 같이 사용할 수 있습니다. re.search(pattern, string) pattern과 맞는 text 정보를 반환합니다. import re str_test = 'This is example word 12345' obj_search_test = re.search(r'example', str_test) # 1 print(obj_search_test) # 2 print(obj_search_test.span()) # 3 print(obj_search_test.group()) # 4 -- Result (8, 15) example 1. example이라는 패턴을 str_test에서 찾습니다. example은 딱히 패턴 기호 형태로 명시되지 않아서 example이라는 단어 ..