🌷🐰🐢🧡❤️💛🥨🔥✍️✌️ ➡ ❌⭕❓❗
class Cookieframe():
v2='변수를 아예 지정함2'
def __init__(self,v1):
print(f'{v1}이 생성되었습니다')
self.v1 = '변수를 아예 지정함'
def self_variable_print(self):
print(self.v1)
print(self.v2)
def self_variable_call(self):
self.self_variable_print()
def not_self_vairable_call(self):
print('self가 필요없으면 안써도 된다?')#가 아닌듯
cookie1 = Cookieframe('cookie1')
#이렇게 바로 쿠키프레임(클래스)에 들어가도 됨? ok
#init(바로호출됨)에 매개변수가 들어가있으니까 바로 넣어줌
cookie1.self_variable_call()
cookie1.not_self_vairable_call()
# print(v2) 이건 안됨 v2는 클래스 안에서 ! 전역변수니까!
from copy import deepcopy
mutable = ['list is mutable']
immutable = 'i am immutable'
list_ = mutable
list_2 = deepcopy(mutable)
string_ = immutable
list_.append('append sth to list')
string_ += 'i am string~!'
print(mutable)
#['list is mutable', 'append sth to list']
print(list_2)
#['list is mutable']
print(immutable)
#i am immutable
print(list_)
#['list is mutable', 'append sth to list']
print(string_)
#i am immutablei am string~!
#리스트는 메모리 주소(id)를 공유하기때문에 1)mutable 3)list_ 값이 같게 출력된다
#-> c언어 포인터 개념과 동일
#만약 값을 변경하고싶지 않다면 2가지 방법 중 선택
#1)deepcopy(mutable)(<- from copy import deepcopy)
#2)mutable[::]
#[start:end:step]
#스트링은 값이 변경되는 순간 메모리 주소가 변경되어 다른 곳에 저장된다
print(id(mutable)) #4478631168 쎔
print(id(list_2)) #4478631360
print(id(immutable))#4478623536
print(id(list_)) #4478631168 쎔
print(id(string_)) #4478677392
alphabet_occurrence_array = [0] * 26
-> 26개 길이의 리스트가 만들어진다
⭐️리스트를 문자열로⭐️ 바꾸기
'문자열사이에 들어갈 것'.join(리스트)
-