잠 못 드는 개발자
close
프로필 배경
프로필 로고

잠 못 드는 개발자

  • 분류 전체보기 (152)
    • Front-end (45)
      • HTML (25)
      • CSS (6)
      • JavaScript (7)
      • React (7)
    • Back-end (21)
      • SQL (2)
      • JAVA (13)
      • Spring (2)
      • Flask (4)
    • AI (64)
      • Python (32)
      • 모두의 딥러닝 (24)
      • NLP (7)
    • Android (5)
    • Git & Github (7)
    • IT 지식 (3)
    • Lecture (8)
  • 홈
  • 태그
  • 방명록
  • 글쓰기

[Python] 11-2장 매직 메소드(__str__()), self, 객체 안의 객체, 상속

__str__() 메소드 - 객체의 데이터를 문자열로 변환할 때 사용 - print(인스턴스) 출력할 때 자동적으로 호출됨 class Car: def __init__(self, speed, color, model): self.speed = speed self.color = color self.model = model def drive(self): self.speed = 60 def __str__(self): msg = "속도 = "+str(self.speed)+" 색상 = "+self.color+" 모델 = "+self.model return msg myCar = Car(0, "red", "SUV") print(myCar) # 속도 = 0 색상 = red 모델 = SUV - 참고로 __str__() 메소..

  • format_list_bulleted AI/Python
  • · 2023. 4. 11.
  • textsms
  • navigate_before
  • 1
  • navigate_next
공지사항
전체 카테고리
  • 분류 전체보기 (152)
    • Front-end (45)
      • HTML (25)
      • CSS (6)
      • JavaScript (7)
      • React (7)
    • Back-end (21)
      • SQL (2)
      • JAVA (13)
      • Spring (2)
      • Flask (4)
    • AI (64)
      • Python (32)
      • 모두의 딥러닝 (24)
      • NLP (7)
    • Android (5)
    • Git & Github (7)
    • IT 지식 (3)
    • Lecture (8)
최근 글
인기 글
최근 댓글
태그
  • #문법
  • #속성
  • #딥러닝
  • #PYTHON
  • #HTML
  • #태그
  • #인공지능
  • #두근두근파이썬
  • #모두의 딥러닝
  • #파이썬
전체 방문자
오늘
어제
전체
Copyright © 쭈미로운 생활 All rights reserved.
Designed by JJuum

티스토리툴바