파이썬 3

텍스트 파일 가공하기 (friends101.txt 가공)

fangj.github.io/friends/season/0101.html The One Where Monica Gets a New Roomate (The Pilot-The Uncut Version) Written by: Marta Kauffman & David Crane Transcribed by: guineapig Additional transcribing by: Eric Aasen (Note: The previously unseen parts of this episode are shown in blue text.) Joey: C'mon, you're going out with the guy! There's gotta be something wro fangj.github.io 예제 파일 다운로드 컨트롤..

파이썬 실습 2021.05.11

파이썬 함수

round 함수 소수점 자리 지정하여 출력하는 법 round(숫자, 표시할 소수점 자릿수) a=3.14 round(a, 1) #출력 3.1 round(a, -1) #출력 0.0 round(a, 2) #출력 3.14 upper 함수 대문자로 출력 x = 'How arE yOu' print(x.upper()) #출력 HOW ARE YOU lower 함수 소문자로 출력 x = 'How arE yOu' print(x.lower()) #출력 how are you lstrip 함수 앞쪽(좌측) 공백 제거 f = ' 앞에 공간있어요, 뒤에도 공간있어요. ' print(f.lstrip()) #출력 (앞에 공간있어요, 뒤에도 공간있어요. ) rstrip 함수 뒤쪽(우측) 공백 제거 f = ' 앞에 공간있어요, 뒤에도 공..

파이썬 2021.04.27

파이썬 Tutorial

함수 파이썬 함수는 ‘def’ 키워드를 통해 정의됩니다 def sign(x): if x > 0: return '양수' elif x < 0: return '음수' else: return 'zero' for x in [-1, 0, 1]: print(sign(x)) # 출력 "음수", "zero", "양수", 한 줄에 하나씩 출력. 클래스 Numpy 라이브러리 대량의 데이터를 사용할때 빠르게 사용할수있음 (내부는 C언어로 이루어져 있음) 각각의 값들은 튜플 rank는 배열이 몇 차원인지를 의미 shape는 는 각 차원의 크기를 알려주는 정수들이 모인 튜플 import numpy as np arr = [1, 2, 3, 4, 5] #list print(type(arr)) #출력 print(arr + 5) #이 줄..

파이썬 2021.04.22