728x90

Programming/Python 3

[Python] Call by reference & Call by Value, 불변타입과 가변타입

알고리즘 및 자료구조(연결리스트)를 공부하던 중 아래와 같은 의문이 들었습니다. ▶궁금했던 내용 아래 코드는 리트코드 21번 Merge Two Sorted Lists에 대한 풀이입니다. https://leetcode.com/problems/merge-two-sorted-lists/ Merge Two Sorted Lists - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com # https://leetcode.com/problems/merge-two-sorted-li..

Programming/Python 2022.03.26

[Python] f-string에 대해서

scores = [ {'name':'영수','score':70}, {'name':'영희','score':65}, {'name':'기찬','score':75}, {'name':'희수','score':23}, {'name':'서경','score':99}, {'name':'미주','score':100}, {'name':'병태','score':32} ] for s in scores: name = s['name'] score = str(s['score']) print(f'{name}의 점수는 {score}점 입니다.') print(name + '의 점수는 ' + str(s[score]) + '점 입니다.'] 로 쓰는 것보다 훨씬 간결하게 표현할 수 있다.

Programming/Python 2022.02.20

[Python] 웹 크롤링(Web Crawling)

1. 사전 준비 먼저 크롤링 하고 싶은 웹사이트의 url을 지정하고 request(요청)하여 아래와 같이 사용할 수 있다. *request 라이브러리 설치는 [파일] - [설정] - [프로젝트: (프로젝트명)] - [Python 인터프리터] - [+버튼 클릭] + [reqeusts검색 후 인스톨] import requests # headers 는 마치 우리가 코드가 아닌 브라우저에서 콜을 날린 것처럼 인식하게 하는 코드다. headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36'} data = requests...

Programming/Python 2022.01.26
728x90