095 바이트 객체를 문자열로 바꾸기(decode)
인코딩(encoding)?
사람이 알아볼 수 있는 언어 > 컴퓨터가 알아볼 수 있는 언어(숫자)
ex) x_train = pd.read_csv("c:\\data\\x_train.csv", encoding = "euckr")
ansi ---> cp949, euckr ----> utf8, utf16
알파벳 한국어
디코딩(decoding)?
컴퓨터가 알아볼 수 있는 언어 > 사람이 알아볼 수 있는 언어
txt ='A' # 문자형 변수 선언
b_txt = txt.encode() # 문자형 변수의 encode 함수(메소드)를 실행
print(b_txt) # b'A' = b(바이너리=이진)가 붙음 = 사람이 알아보는 언어
c_txt = b_txt.decode() # 인코딩된 문자를 디코딩함.
print(c_txt)
반응형
'Study > class note' 카테고리의 다른 글
python / 커피키오스크 data add함수 따로 뺀 코드 (0) | 2021.12.28 |
---|---|
python / 리스트(range,index, 슬라이싱, reverse(d),합치기(+),반복(*),append,insert,del,remove,len ,count) (0) | 2021.12.27 |
python / 문자열(isalnum, upper, lower, lstrip, rstrip, strip, count, find, split, join, replace, encode) (0) | 2021.12.24 |
python / 문자열(슬라이싱, 스텝,+,*, in, len,isalpha,isdigit) (0) | 2021.12.23 |
python / 커피 키오스크 + data_add 따로 빼기 (0) | 2021.12.22 |