<jupyter_start><jupyter_text>올바른 가격 정보 가져오기(세일 가격이면 세일가격으로)<jupyter_code>url="https://search.musinsa.com/category/002012"
html= urlopen(url)
bs= BeautifulSoup(html, "html.parser")
ex_price=[]
for item_price in bs.find_all('p',{"class":"price"}):
    ex_price.append(no_space(item_price.get_text()))
for i in range(len(ex_price)):
    ex_price[i]=ex_price[i].replace(" ", "")
ex_price
for i in ex_price:
  a=i.replace(" ",'')
  b=a.replace("원", '.')
  c=b.split('.')
  if len(c)>2:
    print(c[1])
  else:
    print(c[0])
for i in range(len(ex_price)):
    if len(ex_price[i].split('원'))> 2:
        ex_price[i]=ex_price[i].split('원')[1]

for i in range(len(ex_price)):
    numbers = re.sub(r'[^0-9]', '', ex_price[i])
    print(numbers)<jupyter_output>11900
13900
19500
11900
34400
10900
35000
24500
17800
19500
18000
19900
10900
12900
21000
23400
29700
28800
19500
10000
23400
19900
21500
21000
14900
23400
21000
21800
37800
17900
25350
21000
25350
21000
15900
21000
17900
12900
15900
23400
23400
23400
21000
25350
21900
19500
8900
39800
32000
18900
15600
21000
39000
24500
11900
24500
27600
21900
23400
24500
9900
39000
23400
27900
24500
11890
23400
23400
39000
16800
21900
28000
24000
27300
15990
39000
35900
11900
14900
25350
25900
42900
15600
19900
28700
29000
11900
19500
23100
28050<jupyter_text>AWS RDS에 접속하여 쿼리 보내기<jupyter_code>query=[]
for j in range(len(item_name_list)):
    query.append("INSERT INTO products(name,brand, price, type) VALUES('"+ item_name_list[j]+"','"+item_brand_list[j]+"',"+item_price_list[j].replace(',','')+", '"+ item_type_list[j]+"');")
import pymysql
db = pymysql.connect(host='musinsa-database.crtzc6j6k6ch.ap-northeast-2.rds.amazonaws.com', user='admin', password='<PASSWORD>', port=3306, db='musinsa')
cursor= db.cursor()
for j in range(len(query)):
    sql=query[j]
    cursor.execute(sql)
result=cursor.fetchall()
print(result)
db.commit()
db.close
print(query[:10])<jupyter_output>["INSERT INTO products(name,brand, price, type) VALUES('레이어드크루넥반팔티셔츠_긴기장[화이트]','무신사 스탠다드',13900, '반팔 티셔츠');", "INSERT INTO products(name,brand, price, type) VALUES('릴렉스핏크루넥반팔티셔츠[화이트]','무신사 스탠다드',11900, '반팔 티셔츠');", "INSERT INTO products(name,brand, price, type) VALUES('베이식크루넥반팔티셔츠[화이트]','무신사 스탠다드',10900, '반팔 티셔츠');", "INSERT INTO products(name,brand, price, type) VALUES('릴렉스핏크루넥반팔티셔츠[블랙]','무신사 스탠다드',11900, '반팔 티셔츠');", "INSERT INTO products(name,brand, price, type) VALUES('EMBROIDERYHANDSOMEDANTEEWHITE','예일',27300, '반팔 티셔츠');", "INSERT INTO products(name,brand, price, type) VALUES('021541레이어드반팔티셔츠(2pck)','지오다노',18000, '반팔 티셔츠');", "INSERT INTO products(name,brand, price, type) VALUES('쿨코튼2-PACK티셔츠','커버낫',34400, '반팔 티셔츠');", "INSERT INTO products(name,brand, price, type) VALUES('[패키지]NYCLOCATIONT-SHIRT(16Colors)[LRPMCTA401M]','그루브라임',35000, '반팔 티셔츠');", "INSERT INTO products(name,brand, price, type) VALUES('020940레이어드반팔티','지오다노',12800, '반팔 티셔츠');", "INSERT INTO products(name,brand, pric[...]
{'fraction_non_alphanumeric': 0.17138955274837828, 'fraction_numerical': 0.18265619665414817, 'mean_word_length': 7.049450549450549, 'pattern_counts': {'":': 1, '<': 8, '<?xml version=': 0, '>': 10, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '488965', 'license': 'MIT', 'n_tokens_mistral': 1810, 'n_tokens_neox': 1638, 'n_words': 256, 'path': 'Code/musinsa_products.ipynb', 'repo_name': 'elephantoid/MUSINSA_Data_pipeline_AWS', 'size': '2927'}