NCFPTeam's Blog

  • 홈
  • 태그
  • 미디어로그
  • 위치로그
  • 방명록

class 1

[Python] Recipe 52192: Add a method to a class instance at runtime

import string import new def __str__(self): classStr = '' for name, value in self.__class__.__dict__.items() + self.__dict__.items(): classStr += string.ljust(name, 15) + '\t' + str(value) + '\n' return classStr def addStr(anInstance): anInstance.__str__ = new.instancemethod(__str__, anInstance, anInstance.__class__) # Test it class TestClass: classSig = 'My Sig' def __init__(self, a=1, b=2, c=3..

문서자료/Python 2009.11.26
이전
1
다음
더보기
프로필사진

NCFPTeam's Blog

세상을 향한 통로...

  • 분류 전체보기 (89)
    • 프로파일링 (8)
    • 무가사음악 (3)
    • 문서자료 (45)
      • Android (9)
      • DBMS (0)
      • FreeBSD (2)
      • SAP (1)
      • Python (4)
      • Ruby (2)
      • PDA (2)
      • 부자준비 (0)
      • 번역공부 (1)
      • 한국역사 (2)
      • 그외분야 (22)
      • 교육분야 (0)
    • 자가격리 (0)
    • 취미생활 (27)
    • 끄적끄적 (6)

Tag

프로파일링, LCD, 강원, 운전, Ruby, 분산투자, C#, SAP, 명령어, 심리, 여행, 용어, PDA폰, 안드로이드, http, Python, abap, Android, 산행, 계산기,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

«   2026/03   »
일 월 화 수 목 금 토
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

방문자수Total

  • Today :
  • Yesterday :

Copyright © AXZ Corp. All rights reserved.

티스토리툴바