• 회원가입
  • 로그인
  • 구글아이디로 로그인

[function] Python - vars() 함수 - 객체의 __dict__ 속성 반환. (= vars함수 = 바르스 함수 = 바스 함수)

5658  

목차

  1. vars() 예제 -  Hz 객체의 __dict__ 속성 반환
  2. vars() 정의
  3. vars() 구문

 

vars() 예제 -  Hz 객체의 __dict__ 속성 반환

 

class Hz:

  site = "홈짱닷컴"

  host = "Homzzang.com"

  open = 2012

x = vars(Hz)

print(x)

 

결과값:
{'__module__': '__main__', 'site': '홈짱닷컴', 'host': 'Homzzang.com', 'open': 2012, '__dict__': <attribute '__dict__' of 'Hz' objects>, '__weakref__': <attribute '__weakref__' of 'Hz' objects>, '__doc__': None}

 

vars() 정의

 

객체의 __dict__ 속성 반환.

 


 

  • __dict__ 속성 : 객체의 변경 가능한 속성을 포함하는 사전.
  • 매개변수 없이 vars() 함수 호출 시, 로컬 기호 테이블이 포함된 dictionary 반환.

 

 

vars() 구문

 

vars(object)

 


[매개변수]

 

object

필수. __dict__ 속성 갖는 객체.

 

 


분류 제목
string Python - capitalize() 메서드 - 문자열의 첫글자만 대문자로 변환. (= capitalize…
string Python - casefold() 메서드 - 모든 문자열을 소문자로 변환. (= casefold메서드 = …
string Python - center() 메서드 - 지정 문자로 문자열 가운데 정렬. (= 센터)
string Python - count() 메서드 ★★ - 지정 문자열 포함 횟수. (= 카운트)
string Python - encode() 메서드 ★★ - 지정 인코딩 방식으로 문자열 인코딩. (= encode메서드…
string Python - endswith() 메서드 - 문자열이 지정 문자열로 끝나는지 체크. (= endswith메…
string Python - expandtabs() 메서드 - 문자열 내 Tab 간격 지정. (= 익스팬드탭스)
string Python - find() 메서드 ★ - 문자열 처음 발견 위치 찾기/검색 (= find메서드 = 파인드 …
string Python - format() 메서드 ★★ - 포맷된 문자열 삽입. (= format메서드 = 포맷) ※ …
string Python - format_map() 메서드 ★ - 문자열 안 지정 값의 형식 지정. (= 포맷맵)
string Python - index() 메서드 ★ - 지정 문자열 처음 위치 찾기/검색. (= 인덱스)
string Python - isalnum() 메서드 - 문자열이 알파벳과 숫자인지 체크. (= isalnum메서드 = …
string Python - isalpha() 메서드 - 문자열이 알파벳뿐인지 체크. (= 이즈알파)
string Python - isdecimal() 메서드 - 문자열이 decimal 숫자뿐인지 체크 (= isdecima…
string Python - isdigit() 메서드 - 문자열이 digit 숫자뿐인지 체크. (= 이즈디지트)
string Python - isidentifier() 메서드 - 문자열이 유효한 식별자인지 체크 (= isidentif…
string Python - islower() 메서드 - 영문 문자열이 소문자뿐인지 체크. (= 이즈로우어)
string Python - isnumeric() 메서드 - 문자열이 numeric 숫자뿐인지 체크. (= 이즈뉴메릭)
string Python - isprintable() 메서드 - 문자열이 모두 인쇄 가능한지 체크. (= isprinta…
string Python - isspace() 메서드 - 문자열이 모두 공백인지 체크 (= isspace메서드 = 이즈스…
9/24
목록
찾아주셔서 감사합니다. Since 2012