훈련 철회 기간이 끝나고 웰컴 키트가 지급되었다.
내용물은 다음과 같다.
감사합니다! 👍
문자열을 패턴에 기반하여 처리할 때 사용하는 형식 언어이다.
email 형식
🔗정규표현식 (Regex) 정리 - 소프트웨어 사색
Python에서는 re 내장 라이브러리로 구현되어 있다.
🔗 Python 정규표현 모듈 re 사용법 (match, search, sub등) - 매일 꾸준히, 더 깊이
import re
p = re.compile() # 정규표현식 패턴 변수화
p.match(str) # 문자열이 앞 부분이 매치되는지 확인, 위치 정보 반환
p.search(str) # 패턴과 일치하는 첫 부분 위치 정보 반환
p.finditer(str) # 매치된 위치 정보를 반복하는 객체 반환 (지연 평가)
p.sub(replace: str, text: str) # text에서 매치된 부분을 replace로 대체
# (?<패턴명>패턴 -> \g<패턴명>)
string = '이정환 010-2222-3333'
string2 = '이정환 010-222-3333'
p = re.compile(r"(?P<name>\w+)\s+(?P<phonenumber>\d{3}-\d{3,4}-\d{4})")
print(p.sub(r'\g<phonenumber> / \g<name>', string))
print(p.sub(r'\g<phonenumber> / \g<name>', string2))
🔗 [Python] f-string 포맷팅 (소수점, 퍼센트, 부동소수점) - codingDNA
x = 10
print(f"{x: 5d}") # 정수를 공백 포함하여 출력
print(f"{x:05d}") # 정수의 왼쪽을 0으로 채워서 출력
f = 0.12321
print(f"{f:.3f}") # 소수점 이하 자리수 제한
print(f"{f:%}") # 백분율로 출력
print(f"{f:.2%}") # 백분율로 출력 (소수점 이하 2자리)
w = 10_000_000
print(f"{w:,}") # 천 단위 구분 기호를 사용하여 출력
print(f"{w:e}") # 지수 표기법으로 출력
try:
# 에러가 발생할 수 있는 코드
pass
except (ValueError, TypeError) as e: # 여러 종류의 예외를 한 번에 처리
print(f"Value or type error: {e}")
except Exception as e:
print(f"An error occurred: {e}")
except KeyboardInterrupt:
print("Execution interrupted by user.")
else:
# 코드가 정상적으로 실행되었을 때
print("No errors occurred.")
finally:
# 항상 실행되는 코드
print("Execution completed.")
while True:
try:
read = input("c:\>")
if read.lower() in ['exit', 'x']:
break
except EOFError as e:
print("EOF 종료")
break
except KeyboardInterrupt:
print("키보드 방해에 의한 종료")
break