전체 글
-
[Python] babel을 이용해서 통화기호와 comma 붙여주기Python 2021. 11. 6. 19:05
from babel.numbers import format_currency USD = format_currency(1000, 'USD', locale='en_US') print(USD) => $1,000 Babel 공식문서 http://babel.pocoo.org/en/latest/api/numbers.html#babel.numbers.format_currency Numbers and Currencies — Babel 2.7.0 documentation Numbers and Currencies The number module provides functionality to format numbers for different locales. This includes arbitrary numbers as we..
-
-
[Python] BeautifulSoup을 이용해서 Table 크롤링하기Python 2021. 11. 6. 03:12
import requests from bs4 import BeautifulSoup url = "https://www.iban.com/currency-codes" iban_result = requests.get(url) iban_soup = BeautifulSoup(iban_result.text, 'html.parser') table = iban_soup.table trs = table.find_all('tr') currency_list=[] for idx, tr in enumerate(trs): if idx > 0: tds = tr.find_all('td') country = tds[0].text.strip() currency = tds[1].text.strip() code = tds[2].text.st..