반응형

전체 글 154

I Am Not Okay - episode 1

Like, my town's won the grand prize for most polluted air in America for a bunch of years in a row now, so.. 더보기 미국에서 가장 공기 나쁘다고 대상 받은 동네야 그것도 몇년째 주구장창 She said it might help with my moods. 더보기 감정조절에 도움이 될거라나 I keep losing my temper. 더보기 자꾸 욱하고 있거든 I don't want to, but it just spills out. 더보기 그러기 싫은데 막 터져나와 So I'm supposed to write... what now? I don't get it. 더보기 뭘 써야 하죠 감이 안와요 Whatever comes t..

English expressions 2021.11.23

[JDBC] 자바 DB 연동하기

/* * JDBC(Java DataBase Connectivity) * - 자바에서 DB 에 접근하기 위한 연결 방식을 제공하는 API(라이브러리) * - 각 DB 제조사에서 제공하는 드라이버를 DB 에 맞게 설정하면 * 데이터베이스 접근 방식 외의 모든 작업은 통일된 방법으로 제공 * => DB 제조사마다 드라이버가 다르므로 각각 다운로드 필요 * ex) MySQL 드라이버 : mysql-connector-java.x.x.xx.jar 파일 * Oracle 드라이버 : ojdbcX.jar 파일 */ /* * * 1. JDBC 드라이버 로드(드라이버 필요) * - java.lang.Class 클래스의 static 메서드 forName() 메서드 호출 *..

JDBC 2021.11.23

[Python]온라인에 있는 라이브러리 사용해서 url 가져오기

indeed 웹사이트의 html정보 가져오기 github에 있는 request코드 복사하기 repl.it에서 패키지에 requests라이브러리 검색해서 설치 import requests indeed_result = requests.get("https://www.indeed.com/jobs?q=python&limit=50&radius=25&start=950") print(indeed_result.text) #html코드 가져오기 3. 코드 복붙해서 html정보를 전부 불러옴 페이지 정보(페이지 숫자들)를 불러오기 위해서 screen scrapping라이브버리인 beautifulsoup을 사용 beautifulsoup : html에서 정보를 추출하기에 유용한 라이브러리 4. repl.it 패키지에서 beau..

Python 2021.11.20

[Python]모듈(Module)

math : 값을 올림해서 반환 import math #import를 사용해서 module가져오기 print(math.ceil(1.2)) 2 fabs :절대값 반환 import math print(math.fabs(-1.2)) 1.2 math를 import하면 기능을 다 가져오게 됨, math에 있는 기능 전부 import할 필요는 x //특정 함수만 가져오려면 from.. import사용 from math import ceil, fsum print(ceil(1.2)) print(fsum([1,2,3,4,5,6,7])) 2 28.0 항상 사용할 것만 import 한다, module전부를 가져올 필요x from math import fsum as fancy_sum #as를 사용해서 이름 지정 가능 prin..

Python 2021.11.20

[Python]for in 반복문

days = ("Mon","Tue","Wed", "Thur","Fri") //튜플 생성 for day in days: //for..in문 생성 print(day) Mon Tue Wed Thur Fri days = ("Mon","Tue","Wed", "Thur","Fri") for day in [1,2,3,4,5]: print(day) 1 2 3 4 5 day 변수는 선언되는 것이 아니라 작업이 시작되면 생김 즉 for문이 실행될때 만들어진다 for..in문에서 변수(day)는 작업되는 배열의 item을 가리킨다 // for loop를 멈추는법 days = ("Mon","Tue","Wed", "Thur","Fri") for day in days: if day is "Wed": break else: prin..

Python 2021.11.19

[Python]if...else, elif..or/and

// b의 타입이 number일때 a+b를 return하고, b가 number가 아니라면 None을 return한다 // b의 타입이 int이거나 float이라면 a+b를 return하고, 위의 조건이 아니라면 None을 return def plus(a,b): if type(b) is int or type(b) is float: return a + b else: return None print(plus(12, 1.2)) 13.2 def age_check(age): print(f"you are {age}") //string안에 변수를 출력하는 문법 if age < 18: print("you cant drink") elif age == 18: print("you are new to this!") elif a..

Python 2021.11.19

[Python]Keyworded Arguments

// String formatting def say_hello(name, age): return f"Hello {name} you are {age} years old" hello = say_hello("Nico","12") print(hello) Hello Nico you are 12 years old string앞에 f(format)를 붙이고 변수의 이름을 { }로 감싸주면 {name}, {age}는 실제 변수의 이름을 나타낸다 = "Hello" + name + "you are" + age + "years old" // argument가 두개인 경우 인자의 순서를 바꿀때 keyword argument사용 def say_hello(name, age): return f"Hello {name} you are..

Python 2021.11.19
반응형