1
2
3
4
5
6
|
class Solution:
def reformatDate(self, date: str) -> str:
month=["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
date=date.split()
ans=date[2]+'-'+'%.2d'%(month.index(date[1])+1)+'-'+'%.2d'%(int(date[0][:-2]))
return(ans)
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 2235. Add Two Integers (0) | 2022.04.12 |
---|---|
leetcode 682. Baseball Game (0) | 2022.04.11 |
leetcode 169. Majority Element (0) | 2022.04.08 |
leetcode 258. Add Digits (0) | 2022.04.08 |
leetcode 1550. Three Consecutive Odds (0) | 2022.04.04 |
댓글