SlideShare a Scribd company logo
1 of 30
PYTHON
ARRAY
모듈
Moon Yong Joon
Array 기초
Array 생성 규칙
array 클래스를 이용해 동일한 타입값(typecode)으
로 인스턴스를 생성하기
array.array(typecode[, initializer])
Array 변수 : type codes
array.array 지정 시 타입코드
type code C Type Python Type Minimum size in bytes
'b' signed char int 1
'B' unsigned char int 1
'u' Py_UNICODE Unicode character 2
'h' signed short int 2
'H' unsigned short int 2
'i' signed int int 2
'I' unsigned int int 2
'l' signed long int 4
'L' unsigned long int 4
'q' signed long long int 8
'Q' unsigned long long int 8
'f' float float 4
'd' double float 8
Array 생성
Array의 인스턴스를 생성하고 인덱스로 조회
Array 변수 : itemsize
Method Description
'itemsize', Array에 구성된 요소들이 메모리 사이즈
Array 이해
list와 array.array 차이점
list와 Array는 sequence data type이지만 처리하
는 기준이 상이
list
array.array
다양한 data type
을 저장하고 처리
단일 typecode를 저
장하고 처리
Array : byte 구성처리
Array를 binary로 변환해서 처리해서 내부 구성을
확인
Array 인덱스/슬라이싱
Array의 인덱스(값)/슬라이싱(일부)를 이용해서 조
회
Array 메소드
Array : append
l = [1,2,3,4] ar = array(‘u', ‘abcdef')
Method List example Array example Description
append(obj) l.append(5)
l
[1, 2, 3, 4, 5]
ar.append(‘g')
ar
array(‘u', ‘abcdefg')
Array 객체에 추가
extend(iterable) l.extend([6,7,8])
l
[1, 2, 3, 4, 5, 6, 7, 8]
ar.extend('abc')
ar
array(‘u', ‘abcdefgabc')
Array 에 시퀀스 타입을 추가
Array : count/index
l = [1,2,3,4] ar = array(‘u', 'helloworld')
Method List example Array example Description
count(obj) l.count(1)
1
ar.count('l')
3
Array 원소에 대한 갯수
index(obj) l.index(2)
1
ar.index('e')
1
Array 내의 원소의 인덱스
Array : insert/pop
l = [1,2,3,4] ar = array(‘u', 'helloworld')
Method List example Array example Description
insert(index,obj) l.insert(2,7)
L
[1, 2, 7, 3, 4]
ar.insert(10,'!')
ar
array(‘u', 'helloworld!')
Array 내에 인덱스 위치에 삽입
pop([i]) l.pop(2)
7
ar.pop()
'c'
ar
array(‘u', 'helloworld')
인덱스가 가르치는 곳에 원소를
삭제, 인덱스가 없으면 제일 끝을
제거
Array : remove/reverse
l = [1,2,3,4], ar = array(‘u', 'helloworld')
Method example Array example Description
remove(obj) l.remove(4)
l
[1, 2, 3]
ar.remove('b')
ar
array(‘u', 'helloworld')
array를 원소의 값으로 제거
reverse() l.reverse()
l
[4, 3, 2, 1]
ar.reverse()
ar
array(‘u', 'dlrowolleh')
array를 반대방향으로 소트
Array : buffer_info
메모리 buffer에 대한 정보를 조회
Method Description
'buffer_info',
Array 주소로 array 정보 불러옴
Array : byteswap
기존 정의된 문자열(unicode, byte)들을 byte를
변경시킴
Method Description
'byteswap', 배열의 모든 항목을 정수 값 지원됩니다. 다른 바이트로 컴퓨터
에 기록 된 파일에서 데이터를 읽을 때 유용합니다.
Array : from/to list
Method Description
'tolist', Array 를 리스트로 전환
'fromlist', List를 Array 내의 원소의 이동
File 처리
Array : fromfile/tofile
Method Description
'fromfile', File에 저장된 값을 Array 에 시퀀스에 추가
'tofile',
배열에 있는 것을 파일에 쓰기
array.array 타입으로 file 처리시 bytes로 처리
해야 함
bytes 처리
Array : from/to bytes
Method Description
'frombytes', byte를 받아 유니코드 array 처리
'tobytes', Array 배열을 byte 타입으로 전달
array.array 타입으로 bytes으로 전환하지 않으
면 데이터가 제대로 변환되지 않음
주의 : ‘u’로 정의
파이썬 3버전은 unicode가 기본이지만
array.array의 “u”로 변환시 출력값이 상이하게
보임
주의 : ‘b’로 정의
파이썬 3버전은 unicode가 기본이지만
array.array의 “b”로 변환해서 처리
문자열 처리
Array: from/to string
Method Description
'fromstring', String을 가져와서 Array 내에 값으로 이동
'tostring', Array 를 스트링으로 전환
array.array 타입으로 string으로 전환하지 않으
면 데이터가 제대로 변환되지 않음
주의 : ‘u’로 정의
파이썬 3버전은 unicode가 기본이지만
array.array의 “u”로 변환시 출력값이 상이하게
보임
주의 : ‘b’로 정의
파이썬 3버전은 unicode가 기본이지만
array.array의 “b”로 변환해서 처리
Unicode 처리
Array: from/to unicode
Method Description
'fromunicode', String을 가져와서 Array 내에 값으로 이동
'tounicode', Array 를 스트링으로 전환
array.array는 bytes 처리이므로 파이썬 3 버전
unicode 일 경우는 이 메소드로 처리

More Related Content

What's hot

Multithread & shared_ptr
Multithread & shared_ptrMultithread & shared_ptr
Multithread & shared_ptr내훈 정
 
파이썬 Collections 모듈 이해하기
파이썬 Collections 모듈 이해하기파이썬 Collections 모듈 이해하기
파이썬 Collections 모듈 이해하기Yong Joon Moon
 
[CSStudy] 코딩인터뷰 완전 분석 #7.pdf
[CSStudy] 코딩인터뷰 완전 분석 #7.pdf[CSStudy] 코딩인터뷰 완전 분석 #7.pdf
[CSStudy] 코딩인터뷰 완전 분석 #7.pdfMinGeun Park
 
딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기 DEVIEW 2016
딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기 DEVIEW 2016딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기 DEVIEW 2016
딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기 DEVIEW 2016Taehoon Kim
 
파이썬으로 나만의 강화학습 환경 만들기
파이썬으로 나만의 강화학습 환경 만들기파이썬으로 나만의 강화학습 환경 만들기
파이썬으로 나만의 강화학습 환경 만들기정주 김
 
Variational Autoencoder Tutorial
Variational Autoencoder Tutorial Variational Autoencoder Tutorial
Variational Autoencoder Tutorial Hojin Yang
 
Variational Autoencoders For Image Generation
Variational Autoencoders For Image GenerationVariational Autoencoders For Image Generation
Variational Autoencoders For Image GenerationJason Anderson
 
파이썬+주요+용어+정리 20160304
파이썬+주요+용어+정리 20160304파이썬+주요+용어+정리 20160304
파이썬+주요+용어+정리 20160304Yong Joon Moon
 
DST 정-말 좋아합니다!!
DST 정-말 좋아합니다!!DST 정-말 좋아합니다!!
DST 정-말 좋아합니다!!ssuser4627e5
 
영화 예매 프로그램 (DB 설계, 프로그램 연동)
영화 예매 프로그램 (DB 설계, 프로그램 연동)영화 예매 프로그램 (DB 설계, 프로그램 연동)
영화 예매 프로그램 (DB 설계, 프로그램 연동)_ce
 
프론트엔드 코딩 컨벤션 자동화 도구
프론트엔드 코딩 컨벤션 자동화 도구프론트엔드 코딩 컨벤션 자동화 도구
프론트엔드 코딩 컨벤션 자동화 도구Taegon Kim
 
SDC 3rd 최흥배님 - Boost.multi_index 사용하기
SDC 3rd 최흥배님 - Boost.multi_index 사용하기SDC 3rd 최흥배님 - Boost.multi_index 사용하기
SDC 3rd 최흥배님 - Boost.multi_index 사용하기OnGameServer
 
backpropagation in neural networks
backpropagation in neural networksbackpropagation in neural networks
backpropagation in neural networksAkash Goel
 

What's hot (20)

Multithread & shared_ptr
Multithread & shared_ptrMultithread & shared_ptr
Multithread & shared_ptr
 
파이썬 Collections 모듈 이해하기
파이썬 Collections 모듈 이해하기파이썬 Collections 모듈 이해하기
파이썬 Collections 모듈 이해하기
 
[CSStudy] 코딩인터뷰 완전 분석 #7.pdf
[CSStudy] 코딩인터뷰 완전 분석 #7.pdf[CSStudy] 코딩인터뷰 완전 분석 #7.pdf
[CSStudy] 코딩인터뷰 완전 분석 #7.pdf
 
딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기 DEVIEW 2016
딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기 DEVIEW 2016딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기 DEVIEW 2016
딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기 DEVIEW 2016
 
파이썬으로 나만의 강화학습 환경 만들기
파이썬으로 나만의 강화학습 환경 만들기파이썬으로 나만의 강화학습 환경 만들기
파이썬으로 나만의 강화학습 환경 만들기
 
Variational Autoencoder Tutorial
Variational Autoencoder Tutorial Variational Autoencoder Tutorial
Variational Autoencoder Tutorial
 
Python OOPs
Python OOPsPython OOPs
Python OOPs
 
Variational Autoencoders For Image Generation
Variational Autoencoders For Image GenerationVariational Autoencoders For Image Generation
Variational Autoencoders For Image Generation
 
파이썬+주요+용어+정리 20160304
파이썬+주요+용어+정리 20160304파이썬+주요+용어+정리 20160304
파이썬+주요+용어+정리 20160304
 
DST 정-말 좋아합니다!!
DST 정-말 좋아합니다!!DST 정-말 좋아합니다!!
DST 정-말 좋아합니다!!
 
Kotlin arrays
Kotlin arraysKotlin arrays
Kotlin arrays
 
NUMPY
NUMPY NUMPY
NUMPY
 
Variational AutoEncoder(VAE)
Variational AutoEncoder(VAE)Variational AutoEncoder(VAE)
Variational AutoEncoder(VAE)
 
NumPy.pptx
NumPy.pptxNumPy.pptx
NumPy.pptx
 
영화 예매 프로그램 (DB 설계, 프로그램 연동)
영화 예매 프로그램 (DB 설계, 프로그램 연동)영화 예매 프로그램 (DB 설계, 프로그램 연동)
영화 예매 프로그램 (DB 설계, 프로그램 연동)
 
프론트엔드 코딩 컨벤션 자동화 도구
프론트엔드 코딩 컨벤션 자동화 도구프론트엔드 코딩 컨벤션 자동화 도구
프론트엔드 코딩 컨벤션 자동화 도구
 
Oppai-Detect 3
Oppai-Detect 3Oppai-Detect 3
Oppai-Detect 3
 
SDC 3rd 최흥배님 - Boost.multi_index 사용하기
SDC 3rd 최흥배님 - Boost.multi_index 사용하기SDC 3rd 최흥배님 - Boost.multi_index 사용하기
SDC 3rd 최흥배님 - Boost.multi_index 사용하기
 
String C Programming
String C ProgrammingString C Programming
String C Programming
 
backpropagation in neural networks
backpropagation in neural networksbackpropagation in neural networks
backpropagation in neural networks
 

Similar to Python array.array 모듈 이해하기

파이썬 문자열 이해하기
파이썬 문자열 이해하기파이썬 문자열 이해하기
파이썬 문자열 이해하기Yong Joon Moon
 
파이썬 문자열 이해하기
파이썬 문자열 이해하기파이썬 문자열 이해하기
파이썬 문자열 이해하기Yong Joon Moon
 
Python+numpy pandas 1편
Python+numpy pandas 1편Python+numpy pandas 1편
Python+numpy pandas 1편Yong Joon Moon
 
파이썬정리 20160130
파이썬정리 20160130파이썬정리 20160130
파이썬정리 20160130Yong Joon Moon
 
Java_02 변수자료형
Java_02 변수자료형Java_02 변수자료형
Java_02 변수자료형Hong Hyo Sang
 
Java 변수자료형
Java 변수자료형Java 변수자료형
Java 변수자료형Hyosang Hong
 
파이썬+데이터+구조+이해하기 20160311
파이썬+데이터+구조+이해하기 20160311파이썬+데이터+구조+이해하기 20160311
파이썬+데이터+구조+이해하기 20160311Yong Joon Moon
 
파이썬+Json+이해하기 20160301
파이썬+Json+이해하기 20160301파이썬+Json+이해하기 20160301
파이썬+Json+이해하기 20160301Yong Joon Moon
 
Startup JavaScript 4 - 객체
Startup JavaScript 4 - 객체Startup JavaScript 4 - 객체
Startup JavaScript 4 - 객체Circulus
 
Javascript - Array
Javascript - ArrayJavascript - Array
Javascript - Arraywonmin lee
 
배열과 포인터
배열과 포인터배열과 포인터
배열과 포인터영기 김
 
2015 Kitel C 언어 강좌3
2015 Kitel C 언어 강좌32015 Kitel C 언어 강좌3
2015 Kitel C 언어 강좌3ssuseraf62e91
 
C프로그래머를 위한 Java 기초 입문 (Java1.5 기준)
C프로그래머를 위한 Java 기초 입문 (Java1.5 기준)C프로그래머를 위한 Java 기초 입문 (Java1.5 기준)
C프로그래머를 위한 Java 기초 입문 (Java1.5 기준)혜웅 박
 
Start IoT with JavaScript - 4.객체1
Start IoT with JavaScript - 4.객체1Start IoT with JavaScript - 4.객체1
Start IoT with JavaScript - 4.객체1Park Jonggun
 
Python datatype
Python datatypePython datatype
Python datatype건희 김
 
빠르게 활용하는 파이썬3 스터디(ch1~4)
빠르게 활용하는 파이썬3 스터디(ch1~4)빠르게 활용하는 파이썬3 스터디(ch1~4)
빠르게 활용하는 파이썬3 스터디(ch1~4)SeongHyun Ahn
 
Python Programming: Type and Object
Python Programming: Type and ObjectPython Programming: Type and Object
Python Programming: Type and ObjectChan Shik Lim
 

Similar to Python array.array 모듈 이해하기 (20)

파이썬 문자열 이해하기
파이썬 문자열 이해하기파이썬 문자열 이해하기
파이썬 문자열 이해하기
 
파이썬 문자열 이해하기
파이썬 문자열 이해하기파이썬 문자열 이해하기
파이썬 문자열 이해하기
 
Python+numpy pandas 1편
Python+numpy pandas 1편Python+numpy pandas 1편
Python+numpy pandas 1편
 
파이썬정리 20160130
파이썬정리 20160130파이썬정리 20160130
파이썬정리 20160130
 
Java_02 변수자료형
Java_02 변수자료형Java_02 변수자료형
Java_02 변수자료형
 
Java 변수자료형
Java 변수자료형Java 변수자료형
Java 변수자료형
 
파이썬+데이터+구조+이해하기 20160311
파이썬+데이터+구조+이해하기 20160311파이썬+데이터+구조+이해하기 20160311
파이썬+데이터+구조+이해하기 20160311
 
파이썬+Json+이해하기 20160301
파이썬+Json+이해하기 20160301파이썬+Json+이해하기 20160301
파이썬+Json+이해하기 20160301
 
Startup JavaScript 4 - 객체
Startup JavaScript 4 - 객체Startup JavaScript 4 - 객체
Startup JavaScript 4 - 객체
 
강의자료3
강의자료3강의자료3
강의자료3
 
Javascript - Array
Javascript - ArrayJavascript - Array
Javascript - Array
 
배열과 포인터
배열과 포인터배열과 포인터
배열과 포인터
 
2015 Kitel C 언어 강좌3
2015 Kitel C 언어 강좌32015 Kitel C 언어 강좌3
2015 Kitel C 언어 강좌3
 
C프로그래머를 위한 Java 기초 입문 (Java1.5 기준)
C프로그래머를 위한 Java 기초 입문 (Java1.5 기준)C프로그래머를 위한 Java 기초 입문 (Java1.5 기준)
C프로그래머를 위한 Java 기초 입문 (Java1.5 기준)
 
Start IoT with JavaScript - 4.객체1
Start IoT with JavaScript - 4.객체1Start IoT with JavaScript - 4.객체1
Start IoT with JavaScript - 4.객체1
 
Python datatype
Python datatypePython datatype
Python datatype
 
[ES6] 12. Array
[ES6] 12. Array[ES6] 12. Array
[ES6] 12. Array
 
빠르게 활용하는 파이썬3 스터디(ch1~4)
빠르게 활용하는 파이썬3 스터디(ch1~4)빠르게 활용하는 파이썬3 스터디(ch1~4)
빠르게 활용하는 파이썬3 스터디(ch1~4)
 
Java standard(8~13)
Java standard(8~13)Java standard(8~13)
Java standard(8~13)
 
Python Programming: Type and Object
Python Programming: Type and ObjectPython Programming: Type and Object
Python Programming: Type and Object
 

More from Yong Joon Moon

Scala companion object
Scala companion objectScala companion object
Scala companion objectYong Joon Moon
 
Scala block expression
Scala block expressionScala block expression
Scala block expressionYong Joon Moon
 
Scala self type inheritance
Scala self type inheritanceScala self type inheritance
Scala self type inheritanceYong Joon Moon
 
Scala type class pattern
Scala type class patternScala type class pattern
Scala type class patternYong Joon Moon
 
Scala nested function generic function
Scala nested function generic functionScala nested function generic function
Scala nested function generic functionYong Joon Moon
 
스칼라 클래스 이해하기 _Scala class understanding
스칼라 클래스 이해하기 _Scala class understanding스칼라 클래스 이해하기 _Scala class understanding
스칼라 클래스 이해하기 _Scala class understandingYong Joon Moon
 
파이썬 반복자 생성자 이해하기
파이썬 반복자 생성자 이해하기파이썬 반복자 생성자 이해하기
파이썬 반복자 생성자 이해하기Yong Joon Moon
 
파이썬 플라스크 이해하기
파이썬 플라스크 이해하기 파이썬 플라스크 이해하기
파이썬 플라스크 이해하기 Yong Joon Moon
 
파이썬 내부 데이터 검색 방법
파이썬 내부 데이터 검색 방법파이썬 내부 데이터 검색 방법
파이썬 내부 데이터 검색 방법Yong Joon Moon
 
파이썬 Xml 이해하기
파이썬 Xml 이해하기파이썬 Xml 이해하기
파이썬 Xml 이해하기Yong Joon Moon
 
파이썬 class 및 function namespace 이해하기
파이썬 class 및 function namespace 이해하기파이썬 class 및 function namespace 이해하기
파이썬 class 및 function namespace 이해하기Yong Joon Moon
 

More from Yong Joon Moon (20)

rust ownership
rust ownership rust ownership
rust ownership
 
Scala namespace scope
Scala namespace scopeScala namespace scope
Scala namespace scope
 
Scala companion object
Scala companion objectScala companion object
Scala companion object
 
Scala block expression
Scala block expressionScala block expression
Scala block expression
 
Scala self type inheritance
Scala self type inheritanceScala self type inheritance
Scala self type inheritance
 
Scala variable
Scala variableScala variable
Scala variable
 
Scala type class pattern
Scala type class patternScala type class pattern
Scala type class pattern
 
Scala match pattern
Scala match patternScala match pattern
Scala match pattern
 
Scala implicit
Scala implicitScala implicit
Scala implicit
 
Scala type args
Scala type argsScala type args
Scala type args
 
Scala trait usage
Scala trait usageScala trait usage
Scala trait usage
 
Scala nested function generic function
Scala nested function generic functionScala nested function generic function
Scala nested function generic function
 
Scala dir processing
Scala dir processingScala dir processing
Scala dir processing
 
Scala syntax function
Scala syntax functionScala syntax function
Scala syntax function
 
스칼라 클래스 이해하기 _Scala class understanding
스칼라 클래스 이해하기 _Scala class understanding스칼라 클래스 이해하기 _Scala class understanding
스칼라 클래스 이해하기 _Scala class understanding
 
파이썬 반복자 생성자 이해하기
파이썬 반복자 생성자 이해하기파이썬 반복자 생성자 이해하기
파이썬 반복자 생성자 이해하기
 
파이썬 플라스크 이해하기
파이썬 플라스크 이해하기 파이썬 플라스크 이해하기
파이썬 플라스크 이해하기
 
파이썬 내부 데이터 검색 방법
파이썬 내부 데이터 검색 방법파이썬 내부 데이터 검색 방법
파이썬 내부 데이터 검색 방법
 
파이썬 Xml 이해하기
파이썬 Xml 이해하기파이썬 Xml 이해하기
파이썬 Xml 이해하기
 
파이썬 class 및 function namespace 이해하기
파이썬 class 및 function namespace 이해하기파이썬 class 및 function namespace 이해하기
파이썬 class 및 function namespace 이해하기
 

Python array.array 모듈 이해하기

  • 3. Array 생성 규칙 array 클래스를 이용해 동일한 타입값(typecode)으 로 인스턴스를 생성하기 array.array(typecode[, initializer])
  • 4. Array 변수 : type codes array.array 지정 시 타입코드 type code C Type Python Type Minimum size in bytes 'b' signed char int 1 'B' unsigned char int 1 'u' Py_UNICODE Unicode character 2 'h' signed short int 2 'H' unsigned short int 2 'i' signed int int 2 'I' unsigned int int 2 'l' signed long int 4 'L' unsigned long int 4 'q' signed long long int 8 'Q' unsigned long long int 8 'f' float float 4 'd' double float 8
  • 5. Array 생성 Array의 인스턴스를 생성하고 인덱스로 조회
  • 6. Array 변수 : itemsize Method Description 'itemsize', Array에 구성된 요소들이 메모리 사이즈
  • 8. list와 array.array 차이점 list와 Array는 sequence data type이지만 처리하 는 기준이 상이 list array.array 다양한 data type 을 저장하고 처리 단일 typecode를 저 장하고 처리
  • 9. Array : byte 구성처리 Array를 binary로 변환해서 처리해서 내부 구성을 확인
  • 12. Array : append l = [1,2,3,4] ar = array(‘u', ‘abcdef') Method List example Array example Description append(obj) l.append(5) l [1, 2, 3, 4, 5] ar.append(‘g') ar array(‘u', ‘abcdefg') Array 객체에 추가 extend(iterable) l.extend([6,7,8]) l [1, 2, 3, 4, 5, 6, 7, 8] ar.extend('abc') ar array(‘u', ‘abcdefgabc') Array 에 시퀀스 타입을 추가
  • 13. Array : count/index l = [1,2,3,4] ar = array(‘u', 'helloworld') Method List example Array example Description count(obj) l.count(1) 1 ar.count('l') 3 Array 원소에 대한 갯수 index(obj) l.index(2) 1 ar.index('e') 1 Array 내의 원소의 인덱스
  • 14. Array : insert/pop l = [1,2,3,4] ar = array(‘u', 'helloworld') Method List example Array example Description insert(index,obj) l.insert(2,7) L [1, 2, 7, 3, 4] ar.insert(10,'!') ar array(‘u', 'helloworld!') Array 내에 인덱스 위치에 삽입 pop([i]) l.pop(2) 7 ar.pop() 'c' ar array(‘u', 'helloworld') 인덱스가 가르치는 곳에 원소를 삭제, 인덱스가 없으면 제일 끝을 제거
  • 15. Array : remove/reverse l = [1,2,3,4], ar = array(‘u', 'helloworld') Method example Array example Description remove(obj) l.remove(4) l [1, 2, 3] ar.remove('b') ar array(‘u', 'helloworld') array를 원소의 값으로 제거 reverse() l.reverse() l [4, 3, 2, 1] ar.reverse() ar array(‘u', 'dlrowolleh') array를 반대방향으로 소트
  • 16. Array : buffer_info 메모리 buffer에 대한 정보를 조회 Method Description 'buffer_info', Array 주소로 array 정보 불러옴
  • 17. Array : byteswap 기존 정의된 문자열(unicode, byte)들을 byte를 변경시킴 Method Description 'byteswap', 배열의 모든 항목을 정수 값 지원됩니다. 다른 바이트로 컴퓨터 에 기록 된 파일에서 데이터를 읽을 때 유용합니다.
  • 18. Array : from/to list Method Description 'tolist', Array 를 리스트로 전환 'fromlist', List를 Array 내의 원소의 이동
  • 20. Array : fromfile/tofile Method Description 'fromfile', File에 저장된 값을 Array 에 시퀀스에 추가 'tofile', 배열에 있는 것을 파일에 쓰기 array.array 타입으로 file 처리시 bytes로 처리 해야 함
  • 22. Array : from/to bytes Method Description 'frombytes', byte를 받아 유니코드 array 처리 'tobytes', Array 배열을 byte 타입으로 전달 array.array 타입으로 bytes으로 전환하지 않으 면 데이터가 제대로 변환되지 않음
  • 23. 주의 : ‘u’로 정의 파이썬 3버전은 unicode가 기본이지만 array.array의 “u”로 변환시 출력값이 상이하게 보임
  • 24. 주의 : ‘b’로 정의 파이썬 3버전은 unicode가 기본이지만 array.array의 “b”로 변환해서 처리
  • 26. Array: from/to string Method Description 'fromstring', String을 가져와서 Array 내에 값으로 이동 'tostring', Array 를 스트링으로 전환 array.array 타입으로 string으로 전환하지 않으 면 데이터가 제대로 변환되지 않음
  • 27. 주의 : ‘u’로 정의 파이썬 3버전은 unicode가 기본이지만 array.array의 “u”로 변환시 출력값이 상이하게 보임
  • 28. 주의 : ‘b’로 정의 파이썬 3버전은 unicode가 기본이지만 array.array의 “b”로 변환해서 처리
  • 30. Array: from/to unicode Method Description 'fromunicode', String을 가져와서 Array 내에 값으로 이동 'tounicode', Array 를 스트링으로 전환 array.array는 bytes 처리이므로 파이썬 3 버전 unicode 일 경우는 이 메소드로 처리