728x90
[아랍 글자가 포함된 문자열은 제거하는 것이 목적.]
※ 문자열에 아랍 글자가 포함되었는지 확인 하는 코드
re.search 의 regular expresssion 사용
import re
for line in lines:
if re.search(r'[\u0600-\u06ff\u0750-\u077f\ufb50-\ufbc1\ufbd3-\ufd3f\ufd50-\ufd8f\ufd50-\ufd8f\ufe70-\ufefc\uFDF0-\uFDFD]+',line):
print(line)
'Python > 알면 쓸모있는 잡다한 코드' 카테고리의 다른 글
check number model parameter and freeze, 모델 파라미터 개수 확인 및 layer freeze 하기 (0) | 2023.06.13 |
---|---|
Downlaod nltk in python 2.7 (0) | 2023.05.09 |
[latex] overleaf - tabular as figure (내가 보려고 작성 tabular 사용법) (0) | 2023.01.25 |
torch.max , torch.argmax 차이 (0) | 2022.11.11 |
[encoding error] 파이썬 인코딩 에러 UnicodeDecodeError: 'utf-8' codec can't decode byte 0x99 in position : invalid start byte (0) | 2022.09.20 |