본문 바로가기 메뉴 바로가기

programming study

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

programming study

검색하기 폼
  • 분류 전체보기 (120)
    • BOJ (77)
    • 자료구조 & 알고리즘 (8)
    • python (12)
    • spring boot (4)
    • java (2)
    • airbnb-clone - Django (16)
  • 방명록

string module (1)
문자열 다루기 - ljust/center/rjust, string module

📌 문자열 정렬하기 - ljust, center, rjust 문자열에 공백문자를 붙이지 않고 python string methods를 이용해서 정렬 할 수 있다. s, n = input().strip().split(' ') n = int(n) print(s.ljust(n)) # 왼쪽 정렬 print(s.center(n)) # 가운데 정렬 print(s.rjust(n)) # 오른쪽 정렬 ljust, center, rjust는 첫번째 인자로 width를 두번째 인자로 fillchar를 받는다. fillchar의 기본값은 공백문자다. width가 문자열의 길이보다 작거나 같으면 원래 문자열을 반환한다. 📌 알파벳 출력하기 - string module 모든 대문자, 모든 소문자, 모든 대소문자, 숫자 등을 사용..

python 2021. 3. 6. 22:21
이전 1 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • Django
  • 양방향 연결 리스트
  • 출력 형식 지정
  • 파이썬
  • ValidataionUtils
  • 선형 배열
  • string module
  • divmod
  • 자료구조
  • postfix notation
  • 스프링부트
  • airbnb clone
  • djnago
  • sequence type
  • ljust
  • tailwind
  • python
  • valid annotation
  • python flag
  • 스택
  • Stack
  • rjust
  • springboot
  • 직접 주입
  • 의존 주입
  • most_common
  • initBinder
  • 선형 탐색
  • for-else
  • 이진 탐색
more
«   2026/04   »
일 월 화 수 목 금 토
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바