[python/알고리즘] rjust(), ljust() | 주어진 길이 안에서 문자 좌우 정렬하기

·2025년 1월 28일
0

ljust() - 왼쪽 정렬

a = 'apple'
a.ljust(10)
# 결과: 'apple    '

len(a.ljust(10))
# 10

ljust() - 오른쪽 정렬

a = 'apple'
a.rjust(10)
# 결과: '     apple'

len(a.rjust(10))
# 10
profile
To Dare is To Do

0개의 댓글