Python ** 모음집 함수편

따띠뚜·2022년 10월 7일
0

python

목록 보기
1/2

유용한 함수 모음집

나에게 단축키와 같은 존재, python의 함수들을 소개합니다.


1. split()

str = '2022-10-07'
arr = str.split('-')
print(arr)
# output -> ['2022','10','07'] 

2. join()

arr = ['2022','10','08']
str = arr.join('.')
print(str)
#output -> '2022.10.08'

3. get()

dict = {'year':2022, 'month':10, 'day':7}
year = dict.get('year')
print('year: ',year)
#output -> year: 2022
time = dict.get('time',0)
print('time: ',time)
#output -> time: 0
profile
고고고

0개의 댓글