📦 Initialize Geulbeot structure and merge Prompts & test projects
This commit is contained in:
11
02. Prompts/문서생성/codedomain/날짜_형식을_Python_v01.py
Normal file
11
02. Prompts/문서생성/codedomain/날짜_형식을_Python_v01.py
Normal file
@@ -0,0 +1,11 @@
|
||||
def format_date(date_str: str, source: str) -> str:
|
||||
"""날짜 형식을 YYYY-MM-DD 로 변환"""
|
||||
try:
|
||||
match = re.search(r'\d{4}-\d{2}-\d{2}', date_str)
|
||||
if match:
|
||||
return match.group(0)
|
||||
if source == '연합뉴스':
|
||||
return datetime.strptime(date_str, '%m-%d %H:%M').strftime('2024-%m-%d')
|
||||
return date_str
|
||||
except Exception:
|
||||
return date_str
|
||||
Reference in New Issue
Block a user