UserDonghu's Note

  • 홈
  • 태그
  • 방명록

메서드 체이닝 1

Python(5) 메서드 체이닝, 형변환

메서드체이닝 연속으로 메서드를 호출하는 것 메서드의 결과값에 메서드를 다시 호출함. 너무 길게 사용해서 가독성을 해치지않게 주의 (한 줄에 79자 안넘게 권고) sentence = ' Hello, World! ' result = sentence.strip().lower().replace('world', 'python') # 1번 스탭 : sentence.strip() == 'Hello, World!' # 2번 스탭 : 'Hello, World!'.lower() == 'hello, world!' # 3번 스탭 : 'hello, world!'.replace('world', 'python') print(result) # 'hello, python!' 백슬러쉬를 이용해서 개행 가능 sentence = ' Hel..

Python 2023.09.11
이전
1
다음
더보기
프로필사진

UserDonghu's Note

락스타가 되고싶다

  • 전체보기 (102)
    • HTML&CSS (16)
      • HTML (6)
      • CSS (10)
    • JS (16)
    • Python (22)
    • Algorithm&CodingTest (4)
      • Algorithm (4)
      • CodingTest (0)
    • Django (20)
      • DRF (6)
    • FastAPI (1)
    • HTTP (0)
    • SQL (1)
    • ERD (0)
    • AWS (2)
    • Git (2)
    • 기타 (4)
      • VSC (3)
    • 나의 일상 (8)

Calendar

«   2025/05   »
일 월 화 수 목 금 토
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 31
https://github.com/UserDongHu

티스토리툴바