728x90
반응형
728x170
import copy
class Animal:
def __init__(self, species, legCount, color):
self.species = species
self.legCount = legCount
self.color = color
harry = Animal("hippogriff", 6, "pink")
harriet = copy.copy(harry)
print(harry.species )
print(harriet.species)
"""
hippogriff
hippogriff
"""
728x90
반응형
그리드형(광고전용)
'Python > copy' 카테고리의 다른 글
[PYTHON/COPY] copy 함수 : 리스트 객체 본사본 만들기 (SHALLOW COPY) (0) | 2017.12.12 |
---|---|
[PYTHON/COPY] deepcopy 함수 : 리스트 객체 복사본 만들기 (DEEP COPY) (0) | 2017.10.03 |
[PYTHON/COPY] copy 함수 : 리스트 객체 복사본 만들기 (SHALLOW COPY) (0) | 2017.10.03 |
댓글을 달아 주세요