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

딥러닝을 이용한 사용자 선호도 기반 의상 추천 알고리즘 Ppt 선수강
딥러닝을 이용한 사용자 선호도 기반 의상 추천 알고리즘 Ppt 선수강딥러닝을 이용한 사용자 선호도 기반 의상 추천 알고리즘 Ppt 선수강
딥러닝을 이용한 사용자 선호도 기반 의상 추천 알고리즘 Ppt 선수강Minji Kang
 
Inline Functions and Default arguments
Inline Functions and Default argumentsInline Functions and Default arguments
Inline Functions and Default argumentsNikhil Pandit
 
programmation orienté objet c++
programmation orienté objet c++programmation orienté objet c++
programmation orienté objet c++coursuniv
 
PYTHON -Chapter 2 - Functions, Exception, Modules and Files -MAULIK BOR...
PYTHON -Chapter 2 - Functions,   Exception, Modules  and    Files -MAULIK BOR...PYTHON -Chapter 2 - Functions,   Exception, Modules  and    Files -MAULIK BOR...
PYTHON -Chapter 2 - Functions, Exception, Modules and Files -MAULIK BOR...Maulik Borsaniya
 
08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.ppt08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.pptTareq Hasan
 
빅데이터, 클라우드, IoT, 머신러닝. 왜 이렇게 많은 것들이 나타날까?
빅데이터, 클라우드, IoT, 머신러닝. 왜 이렇게 많은 것들이 나타날까?빅데이터, 클라우드, IoT, 머신러닝. 왜 이렇게 많은 것들이 나타날까?
빅데이터, 클라우드, IoT, 머신러닝. 왜 이렇게 많은 것들이 나타날까?Yongho Ha
 
Introduction à React JS
Introduction à React JSIntroduction à React JS
Introduction à React JSAbdoulaye Dieng
 
Chapitre6: Surcharge des opérateurs
Chapitre6:  Surcharge des opérateursChapitre6:  Surcharge des opérateurs
Chapitre6: Surcharge des opérateursAziz Darouichi
 
An Introduction to Programming in Java: Arrays
An Introduction to Programming in Java: ArraysAn Introduction to Programming in Java: Arrays
An Introduction to Programming in Java: ArraysMartin Chapman
 
요즘 유행하는 AI 나도 해보자 (feat. CoreML)
요즘 유행하는 AI 나도 해보자 (feat. CoreML)요즘 유행하는 AI 나도 해보자 (feat. CoreML)
요즘 유행하는 AI 나도 해보자 (feat. CoreML)Chiwon Song
 
コンセプチュアルスキル説明資料(公開版)
コンセプチュアルスキル説明資料(公開版)コンセプチュアルスキル説明資料(公開版)
コンセプチュアルスキル説明資料(公開版)Tetsuto Yoshikawa
 
Virtual base class
Virtual base classVirtual base class
Virtual base classTech_MX
 
한국어 문서 추출요약 AI 경진대회- 좌충우돌 후기
한국어 문서 추출요약 AI 경진대회- 좌충우돌 후기한국어 문서 추출요약 AI 경진대회- 좌충우돌 후기
한국어 문서 추출요약 AI 경진대회- 좌충우돌 후기Hangil Kim
 
Poo en c++ les relations entre classes
Poo en c++ les relations entre classesPoo en c++ les relations entre classes
Poo en c++ les relations entre classesAmina HAMEURLAINE
 
Python Datatypes by SujithKumar
Python Datatypes by SujithKumarPython Datatypes by SujithKumar
Python Datatypes by SujithKumarSujith Kumar
 
인공지능 방법론 - 딥러닝 이해하기
인공지능 방법론 - 딥러닝 이해하기인공지능 방법론 - 딥러닝 이해하기
인공지능 방법론 - 딥러닝 이해하기Byoung-Hee Kim
 

What's hot (20)

딥러닝을 이용한 사용자 선호도 기반 의상 추천 알고리즘 Ppt 선수강
딥러닝을 이용한 사용자 선호도 기반 의상 추천 알고리즘 Ppt 선수강딥러닝을 이용한 사용자 선호도 기반 의상 추천 알고리즘 Ppt 선수강
딥러닝을 이용한 사용자 선호도 기반 의상 추천 알고리즘 Ppt 선수강
 
Data types in java
Data types in javaData types in java
Data types in java
 
Inline Functions and Default arguments
Inline Functions and Default argumentsInline Functions and Default arguments
Inline Functions and Default arguments
 
programmation orienté objet c++
programmation orienté objet c++programmation orienté objet c++
programmation orienté objet c++
 
PYTHON -Chapter 2 - Functions, Exception, Modules and Files -MAULIK BOR...
PYTHON -Chapter 2 - Functions,   Exception, Modules  and    Files -MAULIK BOR...PYTHON -Chapter 2 - Functions,   Exception, Modules  and    Files -MAULIK BOR...
PYTHON -Chapter 2 - Functions, Exception, Modules and Files -MAULIK BOR...
 
08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.ppt08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.ppt
 
빅데이터, 클라우드, IoT, 머신러닝. 왜 이렇게 많은 것들이 나타날까?
빅데이터, 클라우드, IoT, 머신러닝. 왜 이렇게 많은 것들이 나타날까?빅데이터, 클라우드, IoT, 머신러닝. 왜 이렇게 많은 것들이 나타날까?
빅데이터, 클라우드, IoT, 머신러닝. 왜 이렇게 많은 것들이 나타날까?
 
Introduction à React JS
Introduction à React JSIntroduction à React JS
Introduction à React JS
 
Chapitre6: Surcharge des opérateurs
Chapitre6:  Surcharge des opérateursChapitre6:  Surcharge des opérateurs
Chapitre6: Surcharge des opérateurs
 
An Introduction to Programming in Java: Arrays
An Introduction to Programming in Java: ArraysAn Introduction to Programming in Java: Arrays
An Introduction to Programming in Java: Arrays
 
요즘 유행하는 AI 나도 해보자 (feat. CoreML)
요즘 유행하는 AI 나도 해보자 (feat. CoreML)요즘 유행하는 AI 나도 해보자 (feat. CoreML)
요즘 유행하는 AI 나도 해보자 (feat. CoreML)
 
コンセプチュアルスキル説明資料(公開版)
コンセプチュアルスキル説明資料(公開版)コンセプチュアルスキル説明資料(公開版)
コンセプチュアルスキル説明資料(公開版)
 
String in java
String in javaString in java
String in java
 
Cours php
Cours phpCours php
Cours php
 
Virtual base class
Virtual base classVirtual base class
Virtual base class
 
한국어 문서 추출요약 AI 경진대회- 좌충우돌 후기
한국어 문서 추출요약 AI 경진대회- 좌충우돌 후기한국어 문서 추출요약 AI 경진대회- 좌충우돌 후기
한국어 문서 추출요약 AI 경진대회- 좌충우돌 후기
 
Chap1: Cours en C++
Chap1: Cours en C++Chap1: Cours en C++
Chap1: Cours en C++
 
Poo en c++ les relations entre classes
Poo en c++ les relations entre classesPoo en c++ les relations entre classes
Poo en c++ les relations entre classes
 
Python Datatypes by SujithKumar
Python Datatypes by SujithKumarPython Datatypes by SujithKumar
Python Datatypes by SujithKumar
 
인공지능 방법론 - 딥러닝 이해하기
인공지능 방법론 - 딥러닝 이해하기인공지능 방법론 - 딥러닝 이해하기
인공지능 방법론 - 딥러닝 이해하기
 

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 변수자료형
Java 변수자료형Java 변수자료형
Java 변수자료형Hyosang Hong
 
Java_02 변수자료형
Java_02 변수자료형Java_02 변수자료형
Java_02 변수자료형Hong Hyo Sang
 
파이썬+데이터+구조+이해하기 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 변수자료형
Java 변수자료형Java 변수자료형
Java 변수자료형
 
Java_02 변수자료형
Java_02 변수자료형Java_02 변수자료형
Java_02 변수자료형
 
파이썬+데이터+구조+이해하기 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
 
파이썬 내부 데이터 검색 방법
파이썬 내부 데이터 검색 방법파이썬 내부 데이터 검색 방법
파이썬 내부 데이터 검색 방법Yong Joon Moon
 
파이썬 Xml 이해하기
파이썬 Xml 이해하기파이썬 Xml 이해하기
파이썬 Xml 이해하기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 이해하기
 

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 일 경우는 이 메소드로 처리