전체 글
-
웹개발일지 #003웹개발 일지 2021. 12. 16. 12:10
import requests from bs4 import BeautifulSoup 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.get('https://www.genie.co.kr/chart/top200?ditc=M&rtm=N&ymd=20210701',headers=headers) soup = BeautifulSoup(data.text, 'html.parser') #body-content > div.newest-list > div > table > tbody > tr:n..
-
파이썬 개발일지 #001파이썬 일지 2021. 12. 14. 12:17
class Monster(): hp = 100 alive = True def damage(self, attack): self.hp = self.hp - attack if self.hp < 0: self.alive = False def status_check(self): if self.alive == True: print('살았다!') else: print('죽었다!') m1 = Monster() m1.damage(150) m1.status_check() m2 = Monster() m2.damage(80) m2.status_check()