노마드코딩 25

#4.8 Status Codes

#4.8 Status Codes ​ 전시간에 배운 내용 : URL을 수정하고 사용할 준비를 했다. ​ from requests import get ​ websites = ( "google.com", "airbnb.com", "https://twitter.com", "facebook.com", "https://tiktok.com" ) ​ for website in websites: if not website.startswith("https://"): website = f"https://{website}" print(website) ​ --------------------------------------------------------- 이번시간에는 website를 출력하는 것 대신에 get(website)..

개발/python 2022.09.22

#4.7 Requests

Requests ​ * Python Standard Library에 기본으로 포함되어 있는 모듈의 예 from random import randint ​ * Python Standard Librarydp 기본으로 포함되어 있지 않은 모듈의 예 (이번시간 배울 내용) ​ - pypi를 어떻게 사용하는가. pypi는 다른 사람이 만든 project나 module을 모아둔 곳이다. ​ requests 프로젝트 - requests란 브라우저는 google서버에 request를 보내고 google서버는 나한테 웹사이트를 보내준다. ​ 후에 requests library를 깔고, import requests를 써주면 된다. https://google.com https://airbnb.com https://twitt..

개발/python 2022.09.21

#4.4 recap

복습! ​ 메소드는 function 함수이다.(데이터에 결합된, 결합된 함수다) ​ print("nico".upper()) >> NICO ​ print("nico".endswith("a")) >> False ​ 메소드는 함수다. 소괄호를 쓰면 실행한다는 뜻이다. 소괄호 안에 argument ("a")를 넣을 수 있다. ​ 함수가 독립적으로 사용되면 라 부르고 데이터에 결합된 함수는 라 한다. ​ ​ 1.list : list는 값들의 목록을 정렬할 수 있도록 한다. ​ numbers = [5,3,1,5,7,3, "글씨", True, 12] ​ numbers.append(["하이"]) ​ print(numbers) numbers.clear() print(numbers) ​ >> [5, 3, 1, 5, 7, ..

개발/python 2022.09.18

#4.3 Dics

Dictionary 만들기 ​ * Dictionry는 {}중괄호임. ([]나 ()가 아님) player = { 'name' : 'nico', 'age' : 12, 'alive' : True, 'fav_food' : ["피자","햄버거"] } print(player) ​ > {'name': 'nico', 'age': 12, 'alive': True} ​ * 파이썬은 메소드를 같는다. print(player.clear) : 딕셔너리 내용 없애기 print(player.copy) print(player.get(key)) print(player.get('age') ​ ​ print(player['fav_food']) * Dictionry도 수정이 가능하다. Tuple만 수정이불가 ​ print(player) p..

개발/python 2022.09.17

#4.1 Lists

name = "nico" print(name.endswith("o")) >> True * 데이터에 결합되어있는 함수(메소드) print(name.endswith("o")) 같은 경우 문자열 'nico'와 결합되어 있다 메소드 = 함수 작성하는 법은 같다 차이점은 호출하는 방식에만 차이가 있다. 함수 + 데이터 = 메소드 함수 = 함수 * List의 장점 days_of_week = ["Mon","Tue","Wed","Thur","Fri"] 1. 리스트에 결합된 메소드 ex1,2,3) 과 같이 삭제, 순서변경, 개수구하기를 할 수 있다 ex1) days_of_week.remove() ex2) days_of_week.reverse() ex3) days_of_week.count("Wed") ex3) 개수 구하기..

개발/python 2022.09.15

#4.0 Methods

METHODS * 지난 #3 CONTROL FLOW 섹션에서는 if, else, elif, while로 프로그램 흐름을 제어하는 방법을 알아보앗다 ---------------------------------------------------------------- #4 DATA STRUCTURE(자료 구조) 1.list 2.tuple 3.dictionary 1. list variable의 연속 mon = "Mon" tue = "Tue" wed = "Wed" thu = "Thur" fri = "Fri" sat = "Sat" ex1) days_of_week = "Mon,Tue,Wed,Thur,Fri" print(days_of_week) >> Mon,Tue,Wed,Thur,Fri => 이 경우, 마지막 요일이나..

개발/python 2022.09.14