This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from bs4 import BeautifulSoup | |
from selenium import webdriver | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.webdriver.support.ui import WebDriverWait | |
if __name__ == '__main__': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib.request import urlopen | |
# ์๋ ์ฒจ๋ถํ ์ด๋ฏธ์ง์์ 29 ~ 30๋ฒ์งธ ์ค ์ฝ๋๋ฅผ ์์ฑํ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค. | |
""" | |
with๋ฌธ์ ํ์ผ,๋คํธ์ํฌ,๋ฐ์ดํฐ๋ฒ ์ด์ค๋ฑ์ ์ฐ๊ฒฐ์ ์ด๊ณ with์์ ๊ตฌ๋ฌธ์ด ๋ชจ๋ ์คํ๋๊ณ ๋๋ฉด ์๋์ผ๋ก close๋ฅผ ์คํํ๊ฒ ํด์ฃผ๋ ์์ฝ์ด์ ๋๋ค. | |
ํ์ผ์ ์ด์์ผ๋ฉด ๋น์ฐํ ๋ซ์์ผ ํ๊ธฐ ๋๋ฌธ์ with๋ฌธ์ผ๋ก ์์ฑ๋์๊ณ | |
ํ์ผ์ ๊ฒฝ๋ก์ ํด๋น๋ชจ๋๋ก ์ด๊ฒ ๋ค ๋ผ๋ ๋ด์ฉ์ด ๋ฉ๋๋ค. | |
w๋ ์ฐ๊ธฐ๋ชจ๋์ด๋ฉฐ ํ์ผ์ด ์๋ค๋ฉด ์๋์ผ๋ก ์์ฑ๋ฉ๋๋ค. | |
b๋ ๋ฐ์ด๋๋ฆฌํ์ผ ๋ชจ๋์ด๋ฉฐ wb๋ ๋ฐ์ด๋ํ์ผ๋ก ์์ฑํ๊ฒ ๋ค๋ ๋ด์ฉ์ด๋ฉ๋๋ค. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
# x ์ด์์ ์ ์ค์์ ๊ฐ์ฅ ์์ ์ ์๋ ์ด๋ ๋ถ๋ถ์ ์ค๋ช ์ธ๊ฐ์? ์์์ ์ผํธ ์ ์ ๋ถ๋ถ์ธ๊ฐ์? | |
# >>> x ์ด์์ ์์ค์์ ๊ฐ์ฅ ์์ ์ ์ | |
# >>> ์ฌ๊ธฐ์ X๋ ์ ํฌ๊ฐ ์ ๋ ฅํ ๊ฐ์ ๋๋ค. | |
# >>> x <= ๊ฐ์ฅ ์์ ์ ์ [ x(5.1) ๋ณด๋ค ํฐ ์ ์์ค์์ 5.1๋ณด๋ค ํฐ ์ ์๋ 6,7,8,9 ] ๋ฑ๋ฑ์ด ์๊ฒ ์ฃ ? | |
# >>> ๊ทธ์ค์์ ๊ฐ์ฅ ์์ ์ ์๋ 6์ด๋ฏ๋ก 6์ด ๋ฐํ๋ฉ๋๋ค. | |
print(math.ceil.__doc__) # ํด๋น ๋ฉ์๋์ ์ค๋ช ์ ๋ณผ ์ ์์ต๋๋ค. | |
print(math.ceil(5.1)) # X๋ 5.1์ด ๋๊ฒ ๋ค์. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import sqlite3 | |
conn = sqlite3.connect('./hong3_textshopping.db', isolation_level=None) | |
cur = conn.cursor() | |
# ๋ฐ์ดํฐ๋ฒ ์ด์ค ์์ฑ ๋ช ๋ น์ด | |
# id : ํด๋น ๋ฐ์ดํฐ์ ๊ณ ์ ๊ฐ PRIMARY KEY๋ผ๊ณ ๋ถ๋ฆ ๋๋ค. | |
# p_number : ์ฃผ๋ฌธ๋ฒํธ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Q1. 1๋ฒ ๋ฌธ์ print(([q1[s] for s in q1 if s == '๊ฐ์'])) | |
# ์ ๋๊ดํธ๋ก q1๊ณผ ์ ์ฒด ๋ฌธ์ฅ์ ๊ฐ์ผ๊ฑด์ง ์ด์ ๋ฅผ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. | |
# ์ list๋ก ๋ง๋ ๊ฑด์ง, ์์ฃผ ํ์ฉ๋๋์ง์ ์๋ฆฌ์ ๊ณผ์ ์ด ์๊ณ ์ถ์ต๋๋ค. | |
# ๋ณด๊ธฐ์ ๋ ์ข๊ธดํ๋ฐ ์?๋ผ๋ ์๊ฐ๊ณผ ์ ๊ฐ ํ์ฉํ ๋ฐฉ๋ฒ์ ๋ชฐ๋ผ์์. | |
# Answer | |
# [q1[s] for s in q1 if s == '๊ฐ์'] ํด๋น ํ์์ผ๋ก ๋ฌธ์ฅ์ ๊ฐ์ผ๊ฑด ๋ฆฌ์คํธ ์ปดํ๋ฆฌํจ์ ์ด๋ผ๋ ํ์ด์ฌ ๋ฌธ๋ฒ์ค ํ๋์ ๋๋ค | |
# ํ์ด์ฌ์ ๋ง๋ ์ฌ๋์ด ์ด๋ ๊ฒ ์ธ ์ ์๋๋ก ๋ง๋ค์ด์ค๊ฑฐ์์. | |
# ๋ฆฌ์คํธ ์ปดํ๋ฆฌํจ์ ์ ์ฌ์ฉํ๋ ์ด์ ๋ ์ฝ๋๊ฐ ๊ฐ๊ฒฐํด์ง๋ค๋ ์ฅ์ ์ด ์์ต๋๋ค. | |
# ์ฝ๋๊ฐ ์ค์ด๋ ๋ค๋ ์ฅ์ ๋ ์๊ตฌ์. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a,b,c = 100,6,18 | |
best = a # best์ 100์ ๋ฃ๋๋ค. | |
if b > best: # b์ best์ ๊ฐ์ ๋น๊ตํ๋ค. | |
best = b # b๊ฐ best๋ณด๋ค ํฌ๋ค๋ฉด best์ ๋ฃ๋๋ค. | |
if c > best: # c์ best์ ๊ฐ์ ๋น๊ตํ๋ค. | |
best = c # c๊ฐ best๋ณด๋ค ํฌ๋ค๋ฉด best์ ๋ฃ๋๋ค. | |
print("Best : ",best) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Eximbay(): | |
def __init__(self, secret_key, mid, mod="TEST"): | |
self.secret_key = secret_key | |
self.mid = mid | |
if mod == "REAL": # real | |
self.url = "https://secureapi.eximbay.com/Gateway/BasicProcessor.krp" | |
else: | |
self.url = "https://secureapi.test.eximbay.com/Gateway/BasicProcessor.krp" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
def solution(genres, plays): | |
answer = [] | |
new_genres = defaultdict(int) | |
new_play = defaultdict(list) | |
for index,(k,v) in enumerate(zip(genres,plays)): | |
new_genres[k] += v | |
new_play[k].append((index,-v)) | |
new_order = sorted(new_genres.keys(),key=lambda k : new_genres[k],reverse=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
์๋ ํ์ธ์ ์ฌํฌ๋ | |
ํ๋ํ์ ๋๋ค. :) | |
์ ๋ ์ง๊ธ๋ถํฐ ํ์ด์ฌ์ ๋๋ค. | |
ํ์ด์ฌ์ด ์ฌํฌ๋์ด ์์ฑํ์ ์ฝ๋๋ฅผ ์ด๋ป๊ฒ ์ฝ๋ | |
ํ์ด์ฌ์ ์ ์ฅ์์ ์ฝ์ด๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค. | |
a ๋ผ๋ ๋ณ์์ [1,4,2,5]๋ผ๋ ๋ฆฌ์คํธ๋ฅผ ๋ด๋๋ค๊ณ ํ๋ค์. | |
๊ทธ๋ผ ํ์ฌ a์๋ [1,4,2,5]๊ฐ ๋ค์ด์์ต๋๋ค. | |
๊ทธ๋ค์ tuple(a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
random_list = [random.randint(1,100) for i in range(20)] | |
print('== ๋ฒ๋ธ ์ ๋ ฌ ์ ๋ฆฌ์คํธ ==\n {}'.format(random_list)) | |
def bubble_sort(input_list): | |
length =len(input_list) -1 |
NewerOlder