"R을 이용한 데이터 처리 & 분석 실무 - 서민구 지음" 정리 자료 #1
- https://thebook.io/006723/
- 첫번째 : goo.gl/FJjOlq
- 두번째 : goo.gl/Wdb90g
- 세번째 : goo.gl/80VGcn
- 네번째 : goo.gl/lblUsR
"R을 이용한 데이터 처리 & 분석 실무 - 서민구 지음" 정리 자료 #2
- https://thebook.io/006723/
- 첫번째 : goo.gl/FJjOlq
- 두번째 : goo.gl/Wdb90g
- 세번째 : goo.gl/80VGcn
- 네번째 : goo.gl/lblUsR
"R을 이용한 데이터 처리 & 분석 실무 - 서민구 지음" 정리 자료 #3
- https://thebook.io/006723/
- 첫번째 : goo.gl/FJjOlq
- 두번째 : goo.gl/Wdb90g
- 세번째 : goo.gl/80VGcn
- 네번째 : goo.gl/lblUsR
Treatment of Domestic Wastewater Using Chemical Coagulation Followed by Geote...paperpublications3
Abstract: The emphasis of this paper is on the filtration performance of geotextiles. As we know treatment of wastewater has become an absolute necessity. An innovative cheap and effective method of purifying and cleaning wastewater before discharging into any other water systems is needed. Coagulation-flocculation is a chemical water treatment technique typically applied prior to sedimentation and filtration to enhance the ability of a treatment process to remove particles. Filtration is considered the most important solid-liquid separation process in water treatment, as well as in wastewater treatment. Geotextile are indeed textiles in the traditional sense, but they consist of synthetic fibers rather than natural ones such as cotton, wool, or silk. Thus bio degradation and subsequent short lifetime is not a problem. These synthetic fibers are made into flexible, porous fabrics by standard weaving machinery or are matted together in a random non-woven manner. Proper selection of geotextile filters plays a key role in achieving satisfactory filtration performance.
Tiger Balm History and Lim Chin Tsong Palace ခ်င္ေခ်ာင္းနန္းေတာ္ HistoryMYO AUNG Myanmar
TIGER BALM HISTORY
Tiger Balm was developed during the 1870s in Rangoon, Burma, by herbalist Aw Chu Kin, son of a Hakka herbalist in China, Aw Leng Fan and brought to market by his sons Aw Boon Haw and Aw Boon Par. His father had sent him to Rangoon in the 1860s to help in his uncle's herbal shop. Eventually, Aw Chu Kin himself set up a family business named Eng Aun Tong meaning "Hall of Everlasting Peace". It aims to deliver health and well being through proven oriental wisdom. It has been customized into a range of formulations to suit today's lifestyles.
https://www.facebook.com/tigerbalm.pk/photos/a.982958258444417.1073741828.981782661895310/986056221467954/?type=3
https://www.facebook.com/permalink.php?story_fbid=1283317745089368&id=1083907628363715
THANKS AND CREDITED TO 2 backpackers FOR FACEBOOK FACE
March 10 at 4:29pm •
LIM CHIM TSONG PALACE YANGON- ခ်င္ေခ်ာင္းနန္းေတာ္-
"R을 이용한 데이터 처리 & 분석 실무 - 서민구 지음" 정리 자료 #1
- https://thebook.io/006723/
- 첫번째 : goo.gl/FJjOlq
- 두번째 : goo.gl/Wdb90g
- 세번째 : goo.gl/80VGcn
- 네번째 : goo.gl/lblUsR
"R을 이용한 데이터 처리 & 분석 실무 - 서민구 지음" 정리 자료 #2
- https://thebook.io/006723/
- 첫번째 : goo.gl/FJjOlq
- 두번째 : goo.gl/Wdb90g
- 세번째 : goo.gl/80VGcn
- 네번째 : goo.gl/lblUsR
"R을 이용한 데이터 처리 & 분석 실무 - 서민구 지음" 정리 자료 #3
- https://thebook.io/006723/
- 첫번째 : goo.gl/FJjOlq
- 두번째 : goo.gl/Wdb90g
- 세번째 : goo.gl/80VGcn
- 네번째 : goo.gl/lblUsR
Treatment of Domestic Wastewater Using Chemical Coagulation Followed by Geote...paperpublications3
Abstract: The emphasis of this paper is on the filtration performance of geotextiles. As we know treatment of wastewater has become an absolute necessity. An innovative cheap and effective method of purifying and cleaning wastewater before discharging into any other water systems is needed. Coagulation-flocculation is a chemical water treatment technique typically applied prior to sedimentation and filtration to enhance the ability of a treatment process to remove particles. Filtration is considered the most important solid-liquid separation process in water treatment, as well as in wastewater treatment. Geotextile are indeed textiles in the traditional sense, but they consist of synthetic fibers rather than natural ones such as cotton, wool, or silk. Thus bio degradation and subsequent short lifetime is not a problem. These synthetic fibers are made into flexible, porous fabrics by standard weaving machinery or are matted together in a random non-woven manner. Proper selection of geotextile filters plays a key role in achieving satisfactory filtration performance.
Tiger Balm History and Lim Chin Tsong Palace ခ်င္ေခ်ာင္းနန္းေတာ္ HistoryMYO AUNG Myanmar
TIGER BALM HISTORY
Tiger Balm was developed during the 1870s in Rangoon, Burma, by herbalist Aw Chu Kin, son of a Hakka herbalist in China, Aw Leng Fan and brought to market by his sons Aw Boon Haw and Aw Boon Par. His father had sent him to Rangoon in the 1860s to help in his uncle's herbal shop. Eventually, Aw Chu Kin himself set up a family business named Eng Aun Tong meaning "Hall of Everlasting Peace". It aims to deliver health and well being through proven oriental wisdom. It has been customized into a range of formulations to suit today's lifestyles.
https://www.facebook.com/tigerbalm.pk/photos/a.982958258444417.1073741828.981782661895310/986056221467954/?type=3
https://www.facebook.com/permalink.php?story_fbid=1283317745089368&id=1083907628363715
THANKS AND CREDITED TO 2 backpackers FOR FACEBOOK FACE
March 10 at 4:29pm •
LIM CHIM TSONG PALACE YANGON- ခ်င္ေခ်ာင္းနန္းေတာ္-
Characterization and Validation of Point Mutation in Breast Cancer 1 (BRCA1) ...paperpublications3
This document summarizes a study that aimed to characterize and validate point mutations in the BRCA1 gene and their relationship to mastitis traits in Sahiwal cattle. The researchers analyzed 120 Sahiwal cattle and targeted a region of intron 6 in the BRCA1 gene. Genotype analysis using PCR-RFLP revealed a monomorphic banding pattern, indicating the sequence was highly conserved in Sahiwal cattle. DNA sequencing also found no significant polymorphisms. Therefore, the reported and in silico screened SNPs could not be considered universal markers for mastitis resistance in all cattle breeds. Further studies with larger sample sizes are needed.
The document discusses the envisioned characteristics of the city of the future. It will be smart, integrated, and make use of alternative resources. Sensors will optimize things like gardening, power grids, and lighting. Transportation will be integrated across systems and include smart traffic management, parking, and possibly driverless cars. Buildings will utilize recyclable technology, green designs, and alternative water and energy sources. Homes will have smart appliances and multifunctional, adjustable furniture as populations increase and space decreases. Cities will also provide communal shelters for disasters.
Este documento describe los pasos del proceso de preparación de muestras para su análisis microscópico, incluyendo la obtención de la muestra, fijación, deshidratación, inclusión en parafina, corte, tinción y montaje. También explica diversos métodos de tinción como hematoxilina y eosina, tricrómicos, argénticos y otros para tejidos específicos, carbohidratos, pigmentos, ácidos nucleicos y microorganismos.
Mensagem em PPS -
Ilhabela
Município em São Paulo
Ilhabela é um dos únicos municípios arquipélagos marinhos brasileiros e é localizado no litoral norte do estado de São Paulo, microrregião de Caraguatatuba. Wikipédia
Área: 347,5 km²
Tempo: 25 °C, vento L a 16 km/h, umidade de 76%
Hotéis: 3 estrelas por uma média de R$326, 5 estrelas por uma média R$527. Ver hotéis
População: 32.197 (2015)
Hora local: quarta-feira, 20:51
Rosie Childs experimented with using an angel symbolizing the Angel of Death for the film poster of "Azrael" but decided it signified the horror genre more than the noir genre. She wanted to incorporate the styles and textures of the "DRIVE" poster, particularly its bold pink colors and edgy design representing neo-noir alongside shadows and lines conveying film noir conventions. Her initial poster stages are shown combining these neo-noir and film noir elements.
Este documento resume las principales teorías sociológicas sobre la desviación social. Define la desviación social como cualquier comportamiento que se aleja de las normas de una sociedad. Explica que la desviación puede ser positiva u negativa y depende de factores como la gravedad del acto, el tiempo, las circunstancias y las personas involucradas. Resume las aportaciones de la teoría marxista, subcultural, funcionalista, del etiquetaje, biológica, clásica y concluye que la desviación ha sido un tema fundamental
Cr final apresentação_ilda_bicacro_espanha_scIlda Bicacro
Este documento descreve o projeto "Nós Propomos!" conduzido na Escola Secundária da Sertã, onde os alunos identificaram problemas locais e desenvolveram propostas de solução. O projeto envolveu 64 alunos em 12 projetos em 2015-2016 e foi apresentado publicamente na escola, universidade e assembleia municipal. Os alunos receberam prêmios por seus trabalhos e o projeto recebeu cobertura da mídia local.
La dermatitis atópica es la enfermedad alérgica cutánea más frecuente, afectando del 1% al 20% de la población. Se caracteriza por lesiones eccematosas pruriginosas que ocurren con más frecuencia en niños menores de 2 años. Es el resultado de una interacción compleja entre factores genéticos, ambientales e inmunológicos que alteran la barrera cutánea y conducen a una inflamación crónica. Su diagnóstico se basa en criterios clínicos como prurito, lesion
Overview of Microsoft Azure AI ServicesCraig Milroy
Microsoft Azure provides various cloud services across different categories including:
- Computer Vision API and Face API allow analyzing images to extract metadata and identify faces.
- Speech and language APIs allow converting speech to text, understanding intent, correcting spelling, and translating between languages.
- Knowledge APIs allow exploring relationships between academic papers and providing personalized recommendations.
- Search APIs allow integrating intelligent search capabilities for images, news, videos and the web into applications.
- Intelligence and analytics services allow embedding machine learning and developing predictive models at scale.
Unlock your potential using 24 Keys to Success and achieve transformation within the 12 Steps of The Hero’s Journey Project. From hero to superhero mentor, students build this ongoing virtual experience to inform and inspire new heroes to attend college through an inclusive, encouraging adventure. Forge your own keys to open new opportunities and unique narratives in your classroom and community by harnessing treasured storytelling systems and empowered agency. Build interactive lessons that guide one’s innovative, educational evolution using storytelling techniques including reflective introductions, challenging problems, and creative solutions.
Este documento describe un taller práctico sobre 10 claves para la implementación de tendencias y enfoques innovadores en la educación. El taller busca que los docentes identifiquen el cambio necesario para incorporar las TIC al aula y currículo. El taller cubre temas como nuevas habilidades del siglo 21, políticas de acceso a TIC, y principios para adaptar la educación a la sociedad actual. Los docentes analizan tendencias pedagógicas e identifican cómo estas se reflejan en su práctica, describiendo una buena práctica
Light Tutorial Python
Studybee 2주차 스터디, 가볍게 보는 파이썬!!!
가볍게 파이썬에 대해서 공부하는 시간입니다~
**http://www.studybee.kr 에서 운영하는 '초심자를 위한 웹개발' 클래스에서 만드는 교재이며,
장고를 이용해 간단하게 블로그를 만드는 것을 목표로 하고 있습니다.
FPV Streaming server system built by Go with ffmpeg.
Receive analog video transmitted by drone, convert it to digital video and streaming to mobile devices.
Improving monitoring systems Interoperability with OpenMetricsChan Shik Lim
Introduction Prometheus with OpenMetrics for improving monitoring system interoperability.
- Introduction Prometheus
- Introduction OpenMetrics
- Demo: Prometheus and Datadog integration with OpenMetrics
This document discusses TimescaleDB, an open-source time-series database built on PostgreSQL. It provides an overview of TimescaleDB, including that it uses hypertables to store time-series data across partitions, allows for easy SQL queries, and scales both vertically and horizontally. The document then demonstrates how to install TimescaleDB, create a hypertable from an existing PostgreSQL table to store time-series data, insert sample data, and perform queries on the data. It concludes with references for more information.
Talk about Kubernetes cluster on baremetal servers for serve internal services.
Sharing my experiences about setup and manage kubernetes cluster on premise.
At first, start with single master kubernetes cluster and enhanced by many opensource softwares.
Add more master nodes for increase server availability.
Use Rook, MetalLB, Ceph, mysql-operator and more opensource projects.
The document discusses various Python data structures and modules for working with data structures efficiently. It covers the abc module for defining abstract base classes, the array module for efficient storage of homogeneous data, the bisect module for working with sorted lists, the collections module which provides high-performance container data types like deque and defaultdict, namedtuple for creating tuple subclasses with named fields, heapq for priority queue implementation, and itertools for functions generating efficient iterators.
6. 객체신원과 타입
is 연산자를이용해두객체의신원을비교하는여러가지방법
# 두 객체를 비교한다
def compare(a, b):
if a is b:
print("a 와 b 는 동일한 객체")
if a == b:
print("a 와 b 는 동일한 값")
if type(a) is type(b):
print("a 와 b 는 동일한 타입")
>>> a = 42
>>> b = 30
>>> compare(a, b)
a 와 b 는 동일한 타입
6
7. 객체신원과 타입
객체타입은객체의클래스라고 하며그 자체도객체로존재
타입객체는고유하게 정의
주어진타입의모든인스턴스에대해서항상동일
타입은is 연산자로비교 가능
>>> item = 10
>>> s = [1, 2, 3]
>>> if type(s) is list:
... s.append(item)
...
>>> s
[1, 2, 3, 10]
7
8. 객체신원과 타입
타입은클래스를통해특수화(specialization)가 가능하기 때문에
isinstance(object, type) 을사용하여검사하는것이좋음
isinstance() 함수는클래스상속관계를인식하여타입검사수행
>>> item = 10
>>> s = [1, 2, 3]
>>> if isinstance(s, list):
... s.append(item)
...
>>> s
[1, 2, 3, 10]
8
9. 참조횟수와쓰레기 수집
모든객체는참조횟수(referencecount)를유지하며, 이값이0이되면
쓰레기 수집(garbagecollection) 단계를거쳐메모리를반납
참조횟수를증가시키는경우
객체가 새로운이름에대입
리스트, 튜플, 사전같은컨테이너에추가
>>> import sys
>>> a = 42
>>> sys.getrefcount(a)
9
>>> b = a
>>> sys.getrefcount(a)
10
>>> c = [a]
>>> sys.getrefcount(a)
11
9
10. 참조횟수와쓰레기 수집
참조횟수를감소시키는경우
del연산자사용
참조가 유효범위를벗어날경우
>>> import sys
>>> a = 42
>>> sys.getrefcount(a)
9
>>> b = a
>>> sys.getrefcount(a)
10
>>> del b
>>> sys.getrefcount(a)
9
인터프리터는숫자나문자열같은변경 불가능한객체에의해사용되는
메모리를절약하기 위해이들을여러곳에서최대한공유
10
11. 참조횟수와쓰레기 수집
순환참조가 존재할경우에는참조횟수를줄일수가 없어메모리를계속점유
>>> import sys
>>> a = {}
>>> b = {}
>>> sys.getrefcount(b)
2
>>> a['b'] = b
>>> sys.getrefcount(b)
3
>>> del a
>>> sys.getrefcount(b)
2
>>> a = {'b': b}
>>> b['a'] = a
>>> del a
>>> sys.getrefcount(b)
3
11
14. 참조와복사
>>> a = [1, 2, 3, 4]
>>> b = a
>>> b is a
True
>>> b[2] = 42
>>> a
[1, 2, 42, 4]
a와b가 동일한객체를참조하기 때문에두변수중하나에가해진변화가
다른변수에서도그대로나타남
이러한영향을방지하려면객체에대한참조가 아니라복사본을생성해서사용
14
16. 얕은복사
a와b는서로다른리스트객체이지만, 그 안의원소는공유
b의한원소에가한변화는a에서도그대로나타남
>>> a = [1, 2, [3, 4]]
>>> b = list(a) # a 에 대한 얕은 복사본 생성
>>> b is a
False
>>> b.append(42) # b 에 새로운 원소 추가
>>> b
[1, 2, [3, 4], 42]
>>> a # a 에 아무런 변화 없음
[1, 2, [3, 4]]
>>> b[2][0] = 100 # b 안에 있는 리스트 중 첫번째 원소 변경
>>> b
[1, 2, [100, 4], 42]
>>> a # a 도 변경됨
[1, 2, [100, 4]]
16
17. 깊은복사
>>> import copy
>>> a = [1, 2, [3, 4]]
>>> b = copy.deepcopy(a) # 깊은 복사를 거쳐 b 생성
>>> b[2][0] = 42
>>> b
[1, 2, [42, 4]]
>>> a # a 가 변경되지 않음
[1, 2, [3, 4]]
17
18. 1급 객체
파이썬에서모든객체는'1급 (first class)' 객체
식별자로명명될수있는모든객체는동일한지위를가짐
이름을가질수있는모든객체는데이터로서취급 가능
>>> items = {
... 'number': 42, # 일반적인 정수형 데이터
... 'text': 'Hello, World!' # 문자열 데이터
... }
>>> items["func"] = abs # abs() 함수 추가
>>> import math
>>> items["math"] = math # 모듈 추가
>>> items["error"] = ValueError # 예외 타입
>>> nums = [1, 2, 3, 4]
>>> items["append"] = nums.append # 다른 객체 메서드 추가
위예제코드에서보는것처럼함수나모듈, 예외타입등모든객체를
데이터로서취급하는것이가능
18
19. 1급 객체
다양한객체를사전에넣고 이를이용해코드실행
>>> items["func"](-42) # abs(-42) 실행
42
>>> items["math"].sqrt(16) # math.sqrt(16) 실행
4.0
>>> try:
... x = int("invalid")
... except items["error"] as e: # except ValueError as e:
... print("Convert failed")
...
Convert failed
>>> items["append"](42) # nums.append(42) 실행
>>> nums
[1, 2, 3, 4, 42]
19
20. 1급 객체
문자열을타입객체리스트를이용해변환하는방법
>>> s = "HELLO,100,3.14"
>>> types = [str, int, float]
>>> values = s.split(",")
>>>
>>> fields = [ty(val) for ty, val in zip(types, values)]
>>> print(fields)
['HELLO', 100, 3.14]
문자열안에있는필드각각을나타낼수있는타입리스트먼저생성후
(타입, 값) 쌍을만들어타입(값) 형태로필드생성
20
28. 모든순서열에공통적인연산
항목 설명
s[i] 순서열의원소i를반환
s[i:j] 조각을반환
s[i:j:stride] 확장분할에의한조각을반환
len(s) s 에있는원소개수
min(s) s 의최솟값
max(s) s 의최댓값
all(s) s 에있는모든항목이True인지검사
any(s) s 에있는아무항목이나True인지를검사
28
29. 모든순서열에공통적인연산
>>> s = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> s[5]
6
>>> s[2:6] # 조각을 반환
[3, 4, 5, 6]
>>> s[1:8:2] # 1에서 8까지 2씩 증가시키면 조각 반환
[2, 4, 6, 8]
>>> len(s)
10
>>> min(s)
1
>>> max(s)
10
>>> sum(s, 0) # s 항목들의 합, 두 번째 인자에 초기값 지정
55
>>> all(s) # s 에 있는 모든 항목이 True 인지 검사
True
>>> any(s) # s 에 있는 아무 항목이나 True 인지 검사
True
29
30. 변경 가능한순서열에적용할수있는연산
항목 설명
s[i] = v 항목대입
s[i:j] = t 조각 대입
s[i:j:stride] 확장분할에의한조각 대입
dels[i] 항목삭제
dels[i:j] 조각 삭제
dels[i:j:stride] 확장분할에의한조각 삭제
30
31. 변경 가능한순서열에적용할수있는연산
>>> s = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> s[0] = 42 # 항목 대입
>>> s
[42, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> s[3:6] = [100, 200, 300] # 조각 대입
>>> s
[42, 2, 3, 100, 200, 300, 7, 8, 9, 10]
>>> s[0:5:2] = [20, 40, 60] # 확장 분할 이용 조각 대입
>>> s
[20, 2, 40, 100, 60, 300, 7, 8, 9, 10]
>>> del s[0] # 항목 삭제
>>> s
[2, 40, 100, 60, 300, 7, 8, 9, 10]
>>> del s[0:2] # 조각 삭제
>>> s
[100, 60, 300, 7, 8, 9, 10]
>>> del s[0:7:2] # 확장 분할 이용 조각 삭제
>>> s
[60, 7, 9]
31
32. 리스트
메서드 설명
list(s) s 를리스트로변환
s.append(x) s 의끝에새로운원소x 추가
s.extend(t) s 의끝에새로운리스트t 추가
s.count(x) s 에서x 가 출현한횟수
s.index(x [, start [, stop]]) s[i]==x 인가장작은i반환
s.insert(i, x) 색인i의위치에x 삽입
s.pop([i]) 리스트에서원소i를제거하면서반환
s.remove(x) s 에서x 를찾아서제거
s.reverse() s 의항목들을그 자리에서뒤집음
s.sort([key [, reverse]]) s 의항목들을그 자리에서정렬
32
33. 리스트
내장함수인list(s) 는반복가능한타입을리스트로변환
s 가 이미리스트이면s 의얕은복사본으로새로운리스트생성
s.append(x) 는리스트끝에새로운원소x 추가
s.index(x) 는리스트에서처음으로나타나는x 를검색
x 가 없을경우에는ValueError 예외발생
s.remove(x) 는리스트에서처음으로나타나는x 를제거
x 가 없을경우에는ValueError 예외발생
s.extend(t) 는t 에있는원소를추가해리스트s 확장
s.sort() 는리스트원소를정렬
s 에있는항목은모두동일한타입이여야함
key 함수를지정해비교를수행할때사용할값 지정가능
reverse플래그를지정해역순정렬가능
s.reverse() 는s 의항목들을뒤집어저장 33
34. 리스트메서드실행
>>> s = list((1, 2, 3, 4)) # 튜플을 이용해 리스트 생성
>>> s
[1, 2, 3, 4]
>>> s.append(10) # 리스트 끝에 10 추가
>>> s
[1, 2, 3, 4, 10]
>>> s.extend([20, 30, 40]) # 다른 리스트를 추가해 확장
>>> s
[1, 2, 3, 4, 10, 20, 30, 40]
>>> s.count(10) # s 안에 있는 10 원소 횟수
1
>>> s.index(10) # s 에서 10이 나타나는 위치
4
>>> s.insert(4, 100) # 4번째 위치에 100을 추가
>>> s
[1, 2, 3, 4, 100, 10, 20, 30, 40]
34
35. 리스트메서드실행
>>> s.pop() # 가장 마지막 원소 삭제
40
>>> s
[1, 2, 3, 4, 100, 10, 20, 30]
>>> s.remove(100) # 100 원소를 찾아 삭제
>>> s
[1, 2, 3, 4, 10, 20, 30]
>>> s.reverse() # s 의 항목을 뒤집어 저장
>>> s
[30, 20, 10, 4, 3, 2, 1]
>>> s.sort() # s 의 원소를 오름차순 정렬
>>> s
[1, 2, 3, 4, 10, 20, 30]
35
47. 문자열메서드: 문자열내부검사
>>> "ABCD".isupper() # 모든 문자열이 대문자인지 검사
True
>>> "abcd1234".isalnum() # 문자열이 알파벳과 숫자로만 이루어졌는지 검사
True
>>> "ABCD".islower() # 모둔 문자열이 소문자인지 검사
False
>>> "".isalnum() # 비어 있는 문자열일 경우에는 False 반환
False
>>> "".isupper() # 비어 있는 문자열일 경우에는 False 반환
False
47
48. 문자열메서드: 검색
find() 메서드는부분문자열을찾지못하면‑1을반환하고
index() 메서드는부분문자열을찾지못하면ValueError 예외발생
>>> s = "hello, world!"
>>> s.find("world") # 지정한 문자열이 처음 나타나는 위치
7
>>> s.find("there") # find() 는 문자열을 찾지 못하면 -1
-1
>>> s.index("world")
7
>>> s.index("there") # index() 는 문자열을 찾지 못하면 예외
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: substring not found
48
49. 문자열메서드: 검색
>>> s = "hello, world. hello, programmer"
>>> s.find("hello")
0
>>> s.rfind("hello")
14
>>> s.index("hello")
0
>>> s.rindex("hello")
14
>>> s.rfind("there")
-1
>>> s.rindex("there")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: substring not found
rfind() 와rindex() 는부분문자열을뒤에서검색하여위치를반환
49
50. 문자열메서드: 분리
>>> s = " name email country state city "
>>> s.split()
['name', 'email', 'country', 'state', 'city']
>>> s.rsplit()
['name', 'email', 'country', 'state', 'city']
>>> s.split(None, 3)
['name', 'email', 'country', 'state city ']
>>> s.rsplit(None, 3)
[' name email', 'country', 'state', 'city']
split(), rsplit() 첫번째인자로분리할문자를지정하고
두번째인자로분리할문자열갯수지정
split() 은왼쪽에서분리할문자열을생성하고
rsplit() 은오른쪽에서분리할문자열을생성
50
51. 문자열메서드: 분리
>>> s = "FIELD-VALUE-OPTION"
>>> s.partition("-")
('FIELD', '-', 'VALUE-OPTION')
>>> s.rpartition("-")
('FIELD-VALUE', '-', 'OPTION')
partition(), rpartition() 메서드는분리자부분문자열을검색한후
분리자앞쪽텍스트, 분리자, 그리고 분리자뒤쪽텍스트로분할
partition() 은왼쪽에서처음나오는분리자부분문자열을검색
rpartition() 은오른쪽에서처음나오는분리자부분문자열을검색
51
54. 문자열메서드: 포맷지정
>>> s = "Your name is {0} and your age is {1}"
>>> s.format("Mike", 40)
'Your name is Mike and your age is 40'
>>> s = "Your name is {name} and your age is {age}"
>>> s.format(name="Mike", age=40)
'Your name is Mike and your age is 40'
54
55. 문자열메서드: 포맷지정
>>> s = "Your name is {item[name]} and
your age is {item[age]}"
>>> person = {"name": "Mike", "age": 40}
>>> s.format(item=person)
'Your name is Mike and your age is 40'
포맷문자열안에있는자리표시자{item} 은간단한색인검색이나
속성검색을포함하는것도가능
{item[n]}: 순서열검색을통해문자열치환
{item[key]}: 사전검색을통해문자열치환
{item.key}: item의속성attr 을이용해문자열치환
55
62. 사전의메서드와연산
>>> person = {"name": "Mike", "age": 40}
>>> person["name"]
'Mike'
>>> person["location"] # 키를 못 찾을 경우 KeyError
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: 'location'
>>> person.get("location", "No data") # 못 찾을 경우 기본 값
'No data'
>>> person.update({"location": "Seoul"})
>>> person
{'name': 'Mike', 'age': 40, 'location': 'Seoul'}
>>> len(person)
3
>>> person.pop("location") # 항목 값을 반환하면서 삭제
'Seoul'
>>> person
{'name': 'Mike', 'age': 40}
62
63. 사전의메서드와연산
>>> m = dict.fromkeys(["name", "age"]) # 키를 가져와 생성
>>> m
{'name': None, 'age': None}
>>> m["name"] = "Mike"
>>> m["age"] = 40
>>> n = m.copy() # 매핑 객체에 대한 얕은 복사본
>>> n["name"] = "David"
>>> m
{'name': 'Mike', 'age': 40}
>>> n
{'name': 'David', 'age': 40}
63
69. 집합타입메서드와연산
>>> a = {1, 3, 5, 7}
>>> b = {1, 2, 4, 6}
>>> len(a)
4
>>> a.difference(b) # 집합 연산 a - b
{3, 5, 7}
>>> a.intersection(b) # 집합 연산 a ∩ b
{1}
>>> a.union(b) # 집합 연산 a ∪ b
{1, 2, 3, 4, 5, 6, 7}
>>> a.symmetric_difference(b) # 집합 연산 a ∪ b - (a ∩ b)
{2, 3, 4, 5, 6, 7}
69
70. 집합타입메서드와연산
>>> a = {1, 3, 5}
>>> b = {1, 3, 5, 7, 9}
>>> a.issubset(b) # a ⊂ b
True
>>> b.issuperset(a) # a ⊂ b
True
>>> a.isdisjoint(b) # a ∩ b is ∅ ?
False
>>> a = {1, 3, 5}
>>> b = {2, 4, 6}
>>> a.isdisjoint(b) # a ∩ b is ∅ ?
True
70
73. 집합타입메서드와연산
변경 가능한집합에사용가능한메서드
>>> a = {1, 3, 5}
>>> b = {2, 3, 5, 7}
>>> a.add(9) # a 집합에 항목 추가
>>> a
{1, 3, 5, 9}
>>> a.difference_update(b) # a := a - b
>>> a
{1, 9}
>>> c = {1, 10}
>>> a.intersection_update(c) # a := a ∩ c
>>> a
{1}
73
74. 집합타입메서드와연산
변경 가능한집합에사용가능한메서드
>>> a = {1, 3, 5, 7}
>>> a.update({1, 1, 3, 3, 5, 9})
>>> a
{1, 3, 5, 7, 9}
>>> a.pop() # 원소를 반환하면서 집합에서 제거
1
>>> a.pop()
3
>>> a
{5, 7, 9}
>>> a.remove(10) # 없는 값을 지정할 경우 KeyError
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: 10
>>> a.discard(10) # 없는 값을 지정할 경우 무시
74
101. 객체비교와순서매기기
객체는하나이상의관계 연산자를구현하는것이가능
각 메서드는두개의인수를받아어떤종류의객체든반환가능
메서드 설명
__lt__(self,other) self< other
__le__(self,other) self≤ other
__gt__(self,other) self> other
__ge__(self,other) self≥ other
__eq__(self,other) self== other
__ne__(self,other) self!= other
== 로비교하거나사전키로사용하려면__eq__() 메서드구현
객체를정렬하거나min(), max() 를사용하려면__lt()__ 메서드구현
101