티스토리 뷰
from bs4 import BeautifulSoup
BeautifulSoup에서 bs4를 import 한다.
page = open("/home/jaeyoon89/DataScience/data/03. test_first.html",'r').read()
soup = BeautifulSoup(page, 'html.parser')
print(soup.prettify())
<!DOCTYPE html> <html> <head> <title> Very Simple HTML Code by PinkWink </title> </head> <body> <div> <p class="inner-text first-item" id="first"> Happy PinkWink. <a href="http://www.pinkwink.kr" id="pw-link"> PinkWink </a> </p> <p class="inner-text second-item"> Happy Data Science. <a href="https://www.python.org" id="py-link"> Python </a> </p> </div> <p class="outer-text first-item" id="second"> <b> Data Science is funny. </b> </p> <p class="outer-text"> <b> All I need is Love. </b> </p> </body> </html>
지금은 파일로 다운받은 html을 읽는 것이기 때문에 open 명령으로 읽기 옵션('r')을 주고 읽으면 된다. 읽은 html 페이지의 내용을 전체 다 보고 싶으면 .prettify() 옵션을 사용하면 들여쓰기가 되어 보기 좋게 나타난다. 지금 위 코드에서 예제로 사용되는 전체 html 코드를 soup라는 변수에 저장했는데, 그 soup라는 변수에서 한 단계 아래에서 포함된 태그들을 알고 싶으면 children 이라는 속성을 사용하면 된다.
list(soup.children)
['html', '\n', <html> <head> <title>Very Simple HTML Code by PinkWink</title> </head> <body> <div> <p class="inner-text first-item" id="first"> Happy PinkWink. <a href="http://www.pinkwink.kr" id="pw-link">PinkWink</a> </p> <p class="inner-text second-item"> Happy Data Science. <a href="https://www.python.org" id="py-link">Python</a> </p> </div> <p class="outer-text first-item" id="second"> <b> Data Science is funny. </b> </p> <p class="outer-text"> <b> All I need is Love. </b> </p> </body> </html>]
이때 soup는 문서 전체를 저장한 변수이기 때문에 그 안에서 html 태그에 접속하고 싶다면,
html = list(soup.children)[2]
html
<html> <head> <title>Very Simple HTML Code by PinkWink</title> </head> <body> <div> <p class="inner-text first-item" id="first"> Happy PinkWink. <a href="http://www.pinkwink.kr" id="pw-link">PinkWink</a> </p> <p class="inner-text second-item"> Happy Data Science. <a href="https://www.python.org" id="py-link">Python</a> </p> </div> <p class="outer-text first-item" id="second"> <b> Data Science is funny. </b> </p> <p class="outer-text"> <b> All I need is Love. </b> </p> </body> </html>
그러면 위와 같은 결과를 얻게 된다. 다시 html의 children을 조사해보면
list(html.children)
['\n', <head> <title>Very Simple HTML Code by PinkWink</title> </head>, '\n', <body> <div> <p class="inner-text first-item" id="first"> Happy PinkWink. <a href="http://www.pinkwink.kr" id="pw-link">PinkWink</a> </p> <p class="inner-text second-item"> Happy Data Science. <a href="https://www.python.org" id="py-link">Python</a> </p> </div> <p class="outer-text first-item" id="second"> <b> Data Science is funny. </b> </p> <p class="outer-text"> <b> All I need is Love. </b> </p> </body>, '\n']
이렇게 나타난다. 우리가 본문으로 흔히 보게 되는 부분이 body 태그의 내용이다.
body = list(html.children)[3]
body
<body> <div> <p class="inner-text first-item" id="first"> Happy PinkWink. <a href="http://www.pinkwink.kr" id="pw-link">PinkWink</a> </p> <p class="inner-text second-item"> Happy Data Science. <a href="https://www.python.org" id="py-link">Python</a> </p> </div> <p class="outer-text first-item" id="second"> <b> Data Science is funny. </b> </p> <p class="outer-text"> <b> All I need is Love. </b> </p> </body>
이렇게 children과 parent를 이용해서 태그를 조사할 수 있고 그냥 한 번에 나타낼 수도 있다.
soup.body
<body> <div> <p class="inner-text first-item" id="first"> Happy PinkWink. <a href="http://www.pinkwink.kr" id="pw-link">PinkWink</a> </p> <p class="inner-text second-item"> Happy Data Science. <a href="https://www.python.org" id="py-link">Python</a> </p> </div> <p class="outer-text first-item" id="second"> <b> Data Science is funny. </b> </p> <p class="outer-text"> <b> All I need is Love. </b> </p> </body>
이렇게 찾을 수도 있다.
list(body.children)
['\n', <div> <p class="inner-text first-item" id="first"> Happy PinkWink. <a href="http://www.pinkwink.kr" id="pw-link">PinkWink</a> </p> <p class="inner-text second-item"> Happy Data Science. <a href="https://www.python.org" id="py-link">Python</a> </p> </div>, '\n', <p class="outer-text first-item" id="second"> <b> Data Science is funny. </b> </p>, '\n', <p class="outer-text"> <b> All I need is Love. </b> </p>, '\n']
또한 body 태그 안에 children의 리스트를 확인할 수 있다. 리스트 자료형에 대해서는 뒤에서 다시 다루자. 지금은 그냥 배열 정도로 생각하고 넘어가자. 위 코드에서 접근한 대로 단계별로 접근하고 다시 그 구조를 코드 속에 담아두는 것은 체계적으로 생각하고 쉽게 접근할 수 있는 장점이 있지만, 복잡하고 큰 크기의 페이지를 접근하는 것에는 쉽지 않다. 만약 접근해야 할 태그를 알고 있다면 find나 find_all 명령을 많이 사용한다.
soup.find_all('p')
[<p class="inner-text first-item" id="first"> Happy PinkWink. <a href="http://www.pinkwink.kr" id="pw-link">PinkWink</a> </p>, <p class="inner-text second-item"> Happy Data Science. <a href="https://www.python.org" id="py-link">Python</a> </p>, <p class="outer-text first-item" id="second"> <b> Data Science is funny. </b> </p>, <p class="outer-text"> <b> All I need is Love. </b> </p>]
위와 같이 모든 p 태그를 찾는 것이다. 물론 하나만 찾을 때는 find 명령을 사용한다.
soup.find('p')
<p class="inner-text first-item" id="first"> Happy PinkWink. <a href="http://www.pinkwink.kr" id="pw-link">PinkWink</a> </p>
이렇게 사용하면 제일 첫 번째 p태그를 찾아준다.
soup.find_all('p', class_='outer-text')
[<p class="outer-text first-item" id="second"> <b> Data Science is funny. </b> </p>, <p class="outer-text"> <b> All I need is Love. </b> </p>]
이렇게 p 태그의 class가 outer-text 인 것을 찾는 것도 가능하다.
soup.find_all(class_='outer-text')
[<p class="outer-text first-item" id="second"> <b> Data Science is funny. </b> </p>, <p class="outer-text"> <b> All I need is Love. </b> </p>]
혹은 그냥 class 이름으로만 outer-text를 찾을 수도 있다.
soup.find_all(id='first')
[<p class="inner-text first-item" id="first"> Happy PinkWink. <a href="http://www.pinkwink.kr" id="pw-link">PinkWink</a> </p>]
또 id가 first인 태그들을 찾을 수도 있다.
soup.find('p')
<p class="inner-text first-item" id="first"> Happy PinkWink. <a href="http://www.pinkwink.kr" id="pw-link">PinkWink</a> </p>
하지만 find 명령은 제일 처음 나타난 태그만 찾아주기 때문에 그 다음 태그만 찾고 싶을 때는 다른 방법을 사용해야 한다.
soup.head
<head> <title>Very Simple HTML Code by PinkWink</title> </head>
soup의 head에 있는 내용이다. 여기서 next_sibling 이라는 명령을 사용할 수 있다.
soup.head.next_sibling
'\n'
soup의 head 다음에 줄바꿈 문자가 있다.
soup.head.next_sibling.next_sibling
<body> <div> <p class="inner-text first-item" id="first"> Happy PinkWink. <a href="http://www.pinkwink.kr" id="pw-link">PinkWink</a> </p> <p class="inner-text second-item"> Happy Data Science. <a href="https://www.python.org" id="py-link">Python</a> </p> </div> <p class="outer-text first-item" id="second"> <b> Data Science is funny. </b> </p> <p class="outer-text"> <b> All I need is Love. </b> </p> </body>
다시 한번 더 이렇게 head와 같은 위치에 있던 body 태그로 접근할 수 있다.
body.p
<p class="inner-text first-item" id="first"> Happy PinkWink. <a href="http://www.pinkwink.kr" id="pw-link">PinkWink</a> </p>
또한 제일 처음 나타나는 p 태그에 대해
body.p.next_sibling.next_sibling
<p class="inner-text second-item"> Happy Data Science. <a href="https://www.python.org" id="py-link">Python</a> </p>
위와 같이 next_sibling을 두 번 걸면 그 다음 p 태그로 이동할 수 있다.
for each_tag in soup.find_all('p'):
print(each_tag.get_text())
Happy PinkWink. PinkWink Happy Data Science. Python Data Science is funny. All I need is Love.
또 get_text() 명령으로 태그 안에 있는 텍스트만 가지고 올 수 있다.
body.get_text()
'\n\n\n Happy PinkWink.\n PinkWink\n\n\n Happy Data Science.\n Python\n\n\n\n\n Data Science is funny.\n \n\n\n\n All I need is Love.\n \n\n'
body 전체에서 get_text()를 하면 태그가 있떤 줄바꿈(\n)이 표시되고 전체 텍스트를 보여준다.
links = soup.find_all('a')
links
[<a href="http://www.pinkwink.kr" id="pw-link">PinkWink</a>, <a href="https://www.python.org" id="py-link">Python</a>]
클릭 가능한 링크를 의미하는 a 태그를 찾았다.
for each in links:
href = each['href']
text = each.string
print(text + ' -> ' + href)
PinkWink -> http://www.pinkwink.kr Python -> https://www.python.org
거기서 href 속성을 찾으면 링크 주소를 얻을 수 있다.
3-2 크롬 개발자 도구를 이용해서 원하는 데이터 찾기¶
먼저 url로 접근하는 경우 urllib에서 urlopen이라는 함수를 import 해둔다.
https://finance.naver.com/marketindex/ 로 접속한 후 미국 usd 1,130.00원 이라는 글자에서 환율을 가져오려 한다.
크롬에서 제일 우측 상단의 기능 메뉴를 누르고 '도구 더보기'를 선택한 후 '개발자 도구'를 선택하면 된다.
거기에서 왼쪽 상단의 마우스 클릭 버튼을 누르고 내가 알고 싶은 곳을 클릭하면 코드를 찾아준다. 최종적으로 span 태그의 value 라는 class를 얻으면 된다.
from urllib.request import urlopen
url = "https://finance.naver.com/marketindex/"
page = urlopen(url)
soup = BeautifulSoup(page, "html.parser")
print(soup.prettify())
<script language="javascript" src="/template/head_js.nhn?referer=info.finance.naver.com&menu=marketindex&submenu=market"> </script> <script src="https://ssl.pstatic.net/imgstock/static.pc/20210401112320/js/info/jindo.min.ns.1.5.3.euckr.js" type="text/javascript"> </script> <script src="https://ssl.pstatic.net/imgstock/static.pc/20210401112320/js/jindo.1.5.3.element-text-patch.js" type="text/javascript"> </script> <div id="container" style="padding-bottom:0px;"> <div class="market_include"> <div class="market_data"> <div class="market1"> <div class="title"> <h2 class="h_market1"> <span> 환전 고시 환율 </span> </h2> </div> <!-- data --> <div class="data"> <ul class="data_lst" id="exchangeList"> <li class="on"> <a class="head usd" href="/marketindex/exchangeDetail.nhn?marketindexCd=FX_USDKRW" onclick="clickcr(this, 'fr1.usdt', '', '', event);"> <h3 class="h_lst"> <span class="blind"> 미국 USD </span> </h3> <div class="head_info point_dn"> <span class="value"> 1,129.00 </span> <span class="txt_krw"> <span class="blind"> 원 </span> </span> <span class="change"> 2.50 </span> <span class="blind"> 하락 </span> </div> </a> <a class="graph_img" href="/marketindex/exchangeDetail.nhn?marketindexCd=FX_USDKRW" onclick="clickcr(this, 'fr1.usdc', '', '', event);"> <img alt="" height="153" src="https://ssl.pstatic.net/imgfinance/chart/marketindex/FX_USDKRW.png" width="295"/> </a> <div class="graph_info"> <span class="time"> 2021.04.02 20:01 </span> <span class="source"> 하나은행 기준 </span> <span class="count"> 고시회차 <span class="num"> 214 </span> 회 </span> </div> </li> <li class=""> <a class="head jpy" href="/marketindex/exchangeDetail.nhn?marketindexCd=FX_JPYKRW" onclick="clickcr(this, 'fr1.jpyt', '', '', event);"> <h3 class="h_lst"> <span class="blind"> 일본 JPY(100엔) </span> </h3> <div class="head_info point_up"> <span class="value"> 1,021.63 </span> <span class="txt_krw"> <span class="blind"> 원 </span> </span> <span class="change"> 0.37 </span> <span class="blind"> 상승 </span> </div> </a> <a class="graph_img" href="/marketindex/exchangeDetail.nhn?marketindexCd=FX_JPYKRW" onclick="clickcr(this, 'fr1.jpyc', '', '', event);"> <img alt="" height="153" src="https://ssl.pstatic.net/imgfinance/chart/marketindex/FX_JPYKRW.png" width="295"/> </a> <div class="graph_info"> <span class="time"> 2021.04.02 20:01 </span> <span class="source"> 하나은행 기준 </span> <span class="count"> 고시회차 <span class="num"> 214 </span> 회 </span> </div> </li> <li class=""> <a class="head eur" href="/marketindex/exchangeDetail.nhn?marketindexCd=FX_EURKRW" onclick="clickcr(this, 'fr1.eurt', '', '', event);"> <h3 class="h_lst"> <span class="blind"> 유럽연합 EUR </span> </h3> <div class="head_info point_up"> <span class="value"> 1,329.74 </span> <span class="txt_krw"> <span class="blind"> 원 </span> </span> <span class="change"> 1.98 </span> <span class="blind"> 상승 </span> </div> </a> <a class="graph_img" href="/marketindex/exchangeDetail.nhn?marketindexCd=FX_EURKRW" onclick="clickcr(this, 'fr1.eurc', '', '', event);"> <img alt="" height="153" src="https://ssl.pstatic.net/imgfinance/chart/marketindex/FX_EURKRW.png" width="295"/> </a> <div class="graph_info"> <span class="time"> 2021.04.02 20:01 </span> <span class="source"> 하나은행 기준 </span> <span class="count"> 고시회차 <span class="num"> 214 </span> 회 </span> </div> </li> <li class=""> <a class="head cny" href="/marketindex/exchangeDetail.nhn?marketindexCd=FX_CNYKRW" onclick="clickcr(this, 'fr1.cnyt', '', '', event);"> <h3 class="h_lst"> <span class="blind"> 중국 CNY </span> </h3> <div class="head_info point_dn"> <span class="value"> 171.80 </span> <span class="txt_krw"> <span class="blind"> 원 </span> </span> <span class="change"> 0.01 </span> <span class="blind"> 하락 </span> </div> </a> <a class="graph_img" href="/marketindex/exchangeDetail.nhn?marketindexCd=FX_CNYKRW" onclick="clickcr(this, 'fr1.cnyc', '', '', event);"> <img alt="" height="153" src="https://ssl.pstatic.net/imgfinance/chart/marketindex/FX_CNYKRW.png" width="295"/> </a> <div class="graph_info"> <span class="time"> 2021.04.02 20:01 </span> <span class="source"> 하나은행 기준 </span> <span class="count"> 고시회차 <span class="num"> 214 </span> 회 </span> </div> </li> </ul> </div> <!-- //data --> </div> <div class="market2"> <div class="title"> <h2 class="h_market2"> <span> 국제 시장 환율 </span> </h2> </div> <!-- data --> <div class="data"> <ul class="data_lst" id="worldExchangeList"> <li class="on"> <a class="head jpy_usd" href="/marketindex/worldExchangeDetail.nhn?marketindexCd=FX_USDJPY" onclick="clickcr(this, 'fr2.jpyut', '', '', event);"> <h3 class="h_lst"> <span class="blind"> 달러/일본 엔 </span> </h3> <div class="head_info point_up"> <span class="value"> 110.5900 </span> <span class="txt_jpy"> <span class="blind"> 엔 </span> </span> <span class="change"> 0.1000 </span> <span class="blind"> 상승 </span> </div> </a> <a class="graph_img" href="/marketindex/worldExchangeDetail.nhn?marketindexCd=FX_USDJPY" onclick="clickcr(this, 'fr2.jpyuc', '', '', event);"> <img alt="" height="153" src="https://ssl.pstatic.net/imgfinance/chart/marketindex/FX_USDJPY.png" width="295"/> </a> <div class="graph_info"> <span class="time"> 2021.04.01 </span> <span class="source"> 모닝스타 기준 </span> </div> </li> <li class=""> <a class="head usd_eur" href="/marketindex/worldExchangeDetail.nhn?marketindexCd=FX_EURUSD" onclick="clickcr(this, 'fr2.eurdt', '', '', event);"> <h3 class="h_lst"> <span class="blind"> 유로/달러 </span> </h3> <div class="head_info point_up"> <span class="value"> 1.1759 </span> <span class="txt_usd"> <span class="blind"> 달러 </span> </span> <span class="change"> 0.0005 </span> <span class="blind"> 상승 </span> </div> </a> <a class="graph_img" href="/marketindex/worldExchangeDetail.nhn?marketindexCd=FX_EURUSD" onclick="clickcr(this, 'fr2.eurdc', '', '', event);"> <img alt="" height="153" src="https://ssl.pstatic.net/imgfinance/chart/marketindex/FX_EURUSD.png" width="295"/> </a> <div class="graph_info"> <span class="time"> 2021.04.01 </span> <span class="source"> 모닝스타 기준 </span> </div> </li> <li class=""> <a class="head usd_gbp" href="/marketindex/worldExchangeDetail.nhn?marketindexCd=FX_GBPUSD" onclick="clickcr(this, 'fr2.gbpdt', '', '', event);"> <h3 class="h_lst"> <span class="blind"> 영국 파운드/달러 </span> </h3> <div class="head_info point_up"> <span class="value"> 1.3820 </span> <span class="txt_usd"> <span class="blind"> 달러 </span> </span> <span class="change"> 0.0024 </span> <span class="blind"> 상승 </span> </div> </a> <a class="graph_img" href="/marketindex/worldExchangeDetail.nhn?marketindexCd=FX_GBPUSD" onclick="clickcr(this, 'fr2.gbpdc', '', '', event);"> <img alt="" height="153" src="https://ssl.pstatic.net/imgfinance/chart/marketindex/FX_GBPUSD.png" width="295"/> </a> <div class="graph_info"> <span class="time"> 2021.04.01 </span> <span class="source"> 모닝스타 기준 </span> </div> </li> <li class=""> <a class="head usd_idx" href="/marketindex/worldExchangeDetail.nhn?marketindexCd=FX_USDX" onclick="clickcr(this, 'fr2.indt', '', '', event);"> <h3 class="h_lst"> <span class="blind"> 달러인덱스 </span> </h3> <div class="head_info point_dn"> <span class="value"> 92.9400 </span> <span class="change"> 0.2900 </span> <span class="blind"> 하락 </span> </div> </a> <a class="graph_img" href="/marketindex/worldExchangeDetail.nhn?marketindexCd=FX_USDX" onclick="clickcr(this, 'fr2.indc', '', '', event);"> <img alt="" height="153" src="https://ssl.pstatic.net/imgfinance/chart/marketindex/FX_USDX.png" width="295"/> </a> <div class="graph_info"> <span class="time"> 2021.04.01 </span> <span class="source"> ICE 기준 </span> </div> </li> </ul> </div> <!-- //data --> </div> <div class="market3"> <div class="title"> <h2 class="h_market3"> <span> 유가·금시세 </span> </h2> </div> <!-- data --> <div class="data"> <ul class="data_lst" id="oilGoldList"> <li class="on"> <a class="head wti" href="/marketindex/worldOilDetail.nhn?marketindexCd=OIL_CL&fdtc=2" onclick="clickcr(this, 'fr3.wtit', '', '', event);"> <h3 class="h_lst"> <span class="blind"> WTI </span> </h3> <div class="head_info point_up"> <span class="value"> 61.45 </span> <span class="txt_usd"> <span class="blind"> 달러 </span> </span> <span class="change"> 2.29 </span> <span class="blind"> 상승 </span> </div> </a> <a class="graph_img" href="/marketindex/worldOilDetail.nhn?marketindexCd=OIL_CL&fdtc=2" onclick="clickcr(this, 'fr3.wtic', '', '', event);"> <img alt="" height="153" src="https://ssl.pstatic.net/imgfinance/chart/marketindex/OIL_CL.png" width="295"/> </a> <div class="graph_info"> <span class="time"> 2021.04.01 </span> <span class="source"> NYMEX(뉴욕상업거래소) 기준 </span> </div> </li> <li class=""> <a class="head gasoline" href="/marketindex/oilDetail.nhn?marketindexCd=OIL_GSL" onclick="clickcr(this, 'fr3.oilt', '', '', event);"> <h3 class="h_lst"> <span class="blind"> 휘발유 </span> </h3> <div class="head_info point_up"> <span class="value"> 1534.68 </span> <span class="txt_krw"> <span class="blind"> 원 </span> </span> <span class="change"> 0.16 </span> <span class="blind"> 상승 </span> </div> </a> <a class="graph_img" href="/marketindex/oilDetail.nhn?marketindexCd=OIL_GSL" onclick="clickcr(this, 'fr3.oilc', '', '', event);"> <img alt="" height="153" src="https://ssl.pstatic.net/imgfinance/chart/marketindex/OIL_GSL.png" width="295"/> </a> <div class="graph_info"> <span class="time"> 2021.04.02 </span> <span class="source"> 한국석유공사 Opinet 기준 </span> </div> </li> <li class=""> <a class="head gold_inter" href="/marketindex/worldGoldDetail.nhn?marketindexCd=CMDT_GC&fdtc=2" onclick="clickcr(this, 'fr3.agoldt', '', '', event);"> <h3 class="h_lst"> <span class="blind"> 국제 금 </span> </h3> <div class="head_info point_up"> <span class="value"> 1726.5 </span> <span class="txt_usd"> <span class="blind"> 달러 </span> </span> <span class="change"> 12.70 </span> <span class="blind"> 상승 </span> </div> </a> <a class="graph_img" href="/marketindex/worldGoldDetail.nhn?marketindexCd=CMDT_GC&fdtc=2" onclick="clickcr(this, 'fr3.agoldc', '', '', event);"> <img alt="" height="153" src="https://ssl.pstatic.net/imgfinance/chart/marketindex/CMDT_GC.png" width="295"/> </a> <div class="graph_info"> <span class="time"> 2021.04.01 </span> <span class="source"> COMEX(뉴욕상품거래소) 기준 </span> </div> </li> <li class=""> <a class="head gold_domestic" href="/marketindex/goldDetail.nhn" onclick="clickcr(this, 'fr3.kgoldt', '', '', event);"> <h3 class="h_lst"> <span class="blind"> 국내 금 </span> </h3> <div class="head_info point_up"> <span class="value"> 62710.03 </span> <span class="txt_krw"> <span class="blind"> 원 </span> </span> <span class="change"> 261.21 </span> <span class="blind"> 상승 </span> </div> </a> <a class="graph_img" href="/marketindex/goldDetail.nhn" onclick="clickcr(this, 'fr3.kgoldc', '', '', event);"> <img alt="" height="153" src="https://ssl.pstatic.net/imgfinance/chart/marketindex/CMDT_GD.png" width="295"/> </a> <div class="graph_info"> <span class="time"> 2021.04.02 18:00 </span> <span class="source"> 신한은행 기준 </span> ( <span class="num"> 134 </span> 회차) </div> </li> </ul> </div> <!-- //data --> </div> </div> </div> <div class="marketindex_content" id="content"> <div class="section_news"> <h3 class="h_news2"> <span> 주요 뉴스 </span> </h3> <div class="list_area"> <ul> <li> <p> <a href="/marketindex/news/newsRead.nhn?officeId=011&articleId=0003892123&category=" onclick="clickcr(this, 'mhn.list', '011_0003892123', '0', event);"> 미얀마 사태, 원자재 수급난으로 번지나 </a> <img alt="NEW" height="8" src="https://ssl.pstatic.net/static/nfinance/ico_new.gif" width="8"/> </p> <span> 04.02 17:28 </span> </li> <li> <p> <a href="/marketindex/news/newsRead.nhn?officeId=018&articleId=0004892076&category=" onclick="clickcr(this, 'mhn.list', '018_0004892076', '1', event);"> 경제회복 청신호 켜지자…금값 5년 만에 최 </a> <img alt="NEW" height="8" src="https://ssl.pstatic.net/static/nfinance/ico_new.gif" width="8"/> </p> <span> 04.02 17:21 </span> </li> <li> <p> <a href="/marketindex/news/newsRead.nhn?officeId=018&articleId=0004892007&category=" onclick="clickcr(this, 'mhn.list', '018_0004892007', '2', event);"> [외환마감]외국인 '증시' 매수에 환율, </a> <img alt="NEW" height="8" src="https://ssl.pstatic.net/static/nfinance/ico_new.gif" width="8"/> </p> <span> 04.02 15:52 </span> </li> <li> <p> <a href="/marketindex/news/newsRead.nhn?officeId=008&articleId=0004567116&category=" onclick="clickcr(this, 'mhn.list', '008_0004567116', '3', event);"> OPEC+ 공급 늘린다는데 국제유가 오른 </a> <img alt="NEW" height="8" src="https://ssl.pstatic.net/static/nfinance/ico_new.gif" width="8"/> </p> <span> 04.02 11:27 </span> </li> <li> <p> <a href="/marketindex/news/newsRead.nhn?officeId=015&articleId=0004523736&category=" onclick="clickcr(this, 'mhn.list', '015_0004523736', '4', event);"> 화려한 시절 갔나…힘 빠진 금값, 언제 오 </a> <img alt="NEW" height="8" src="https://ssl.pstatic.net/static/nfinance/ico_new.gif" width="8"/> </p> <span> 04.02 10:48 </span> </li> <li> <p> <a href="/marketindex/news/newsRead.nhn?officeId=277&articleId=0004877671&category=" onclick="clickcr(this, 'mhn.list', '277_0004877671', '5', event);"> 금값 1분기 9.5% 하락 '5년 만에 최 </a> <img alt="NEW" height="8" src="https://ssl.pstatic.net/static/nfinance/ico_new.gif" width="8"/> </p> <span> 04.02 10:28 </span> </li> <li> <p> <a href="/marketindex/news/newsRead.nhn?officeId=018&articleId=0004891488&category=" onclick="clickcr(this, 'mhn.list', '018_0004891488', '6', event);"> [외환브리핑]경기회복 빨라지나..위험선호 </a> <img alt="NEW" height="8" src="https://ssl.pstatic.net/static/nfinance/ico_new.gif" width="8"/> </p> <span> 04.02 08:12 </span> </li> <li> <p> <a href="/marketindex/news/newsRead.nhn?officeId=015&articleId=0004523584&category=" onclick="clickcr(this, 'mhn.list', '015_0004523584', '7', event);"> "원유 수요 늘어날 것"…국제유가 '급등' </a> <img alt="NEW" height="8" src="https://ssl.pstatic.net/static/nfinance/ico_new.gif" width="8"/> </p> <span> 04.02 08:00 </span> </li> <li> <p> <a href="/marketindex/news/newsRead.nhn?officeId=417&articleId=0000676905&category=" onclick="clickcr(this, 'mhn.list', '417_0000676905', '8', event);"> [오늘의 환율전망] 원/달러, 1128~1 </a> <img alt="NEW" height="8" src="https://ssl.pstatic.net/static/nfinance/ico_new.gif" width="8"/> </p> <span> 04.02 07:52 </span> </li> <li> <p> <a href="/marketindex/news/newsRead.nhn?officeId=014&articleId=0004613038&category=" onclick="clickcr(this, 'mhn.list', '014_0004613038', '9', event);"> [원자재시황] 경기회복 기대감에 유가↑, </a> <img alt="NEW" height="8" src="https://ssl.pstatic.net/static/nfinance/ico_new.gif" width="8"/> </p> <span> 04.02 07:36 </span> </li> </ul> </div> <a class="btn_more" href="/marketindex/news/newsList.nhn" onclick="clickcr(this, 'mhn.more', '', '', event);"> <img alt="더보기" height="18" src="https://ssl.pstatic.net/static/nfinance/btn_more.gif" width="34"/> </a> </div> <div class="tab_default1" id="tab_section"> <ul> <li class="on"> <a href="./?tabSel=exchange#tab_section" onclick="clickcr(this, 'mtb.exnoti', '', '', event);"> <span class="tab1"> 환전고시 환율 </span> </a> </li> <li class=""> <a href="./?tabSel=worldExchange#tab_section" onclick="clickcr(this, 'mtb.interex', '', '', event);"> <span class="tab2"> 국제시장 환율 </span> </a> </li> <li class=""> <a href="./?tabSel=gold#tab_section" onclick="clickcr(this, 'mtb.oilgold', '', '', event);"> <span class="tab3"> 유가 금시세 </span> </a> </li> <li class=""> <a href="./?tabSel=materials#tab_section" onclick="clickcr(this, 'mtb.material', '', '', event);"> <span class="tab4"> 원자재 </span> </a> </li> </ul> <h2 class="blind"> 환전고시 환율 </h2> </div> <div class="section_calculator"> <h3 class="h_calculator"> <span> 환율계산기 (매매기준율 기준) </span> </h3> <div class="calculator"> <div class="inner"> <div class="input"> <div class="selectbox-noscript" id="sInput"> <select class="selectbox-source" id="select_from"> <option label="1" value="1"> 대한민국 원 KRW </option> <option class="selectbox-default" label="1" selected="selected" value="1129.0"> 미국 달러 USD </option> <option label="1" value="1129.0"> 미국 달러 USD </option> <option label="1" value="1329.74"> 유럽연합 유로 EUR </option> <option label="100" value="10.2163"> 일본 엔 JPY </option> <option label="1" value="171.8"> 중국 위안 CNY </option> <option label="1" value="145.2"> 홍콩 달러 HKD </option> <option label="1" value="39.61"> 대만 달러 TWD </option> <option label="1" value="1562.48"> 영국 파운드 GBP </option> <option label="1" value="2932.47"> 오만 리알 OMR </option> <option label="1" value="899.39"> 캐나다 달러 CAD </option> <option label="1" value="1200.17"> 스위스 프랑 CHF </option> <option label="1" value="129.53"> 스웨덴 크로나 SEK </option> <option label="1" value="860.13"> 호주 달러 AUD </option> <option label="1" value="793.8"> 뉴질랜드 달러 NZD </option> <option label="1" value="50.96"> 체코 코루나 CZK </option> <option label="1" value="1.57"> 칠레 페소 CLP </option> <option label="1" value="140.14"> 터키 리라 TRY </option> <option label="1" value="0.4"> 몽골 투그릭 MNT </option> <option label="1" value="339.44"> 이스라엘 세켈 ILS </option> <option label="1" value="178.77"> 덴마크 크로네 DKK </option> <option label="1" value="132.39"> 노르웨이 크로네 NOK </option> <option label="1" value="301.03"> 사우디아라비아 리얄 SAR </option> <option label="1" value="3737.17"> 쿠웨이트 디나르 KWD </option> <option label="1" value="2994.06"> 바레인 디나르 BHD </option> <option label="1" value="307.37"> 아랍에미리트 디르함 AED </option> <option label="1" value="1592.38"> 요르단 디나르 JOD </option> <option label="1" value="71.84"> 이집트 파운드 EGP </option> <option label="1" value="36.06"> 태국 바트 THB </option> <option label="1" value="840.06"> 싱가포르 달러 SGD </option> <option label="1" value="272.71"> 말레이시아 링깃 MYR </option> <option label="100" value="0.0779"> 인도네시아 루피아 IDR </option> <option label="1" value="310.08"> 카타르 리얄 QAR </option> <option label="1" value="2.64"> 카자흐스탄 텡게 KZT </option> <option label="1" value="840.06"> 브루나이 달러 BND </option> <option label="1" value="15.39"> 인도 루피 INR </option> <option label="1" value="7.37"> 파키스탄 루피 PKR </option> <option label="1" value="13.32"> 방글라데시 타카 BDT </option> <option label="1" value="23.24"> 필리핀 페소 PHP </option> <option label="1" value="55.66"> 멕시코 페소 MXN </option> <option label="1" value="197.76"> 브라질 레알 BRL </option> <option label="100" value="0.0489"> 베트남 동 VND </option> <option label="1" value="77.18"> 남아프리카 공화국 랜드 ZAR </option> <option label="1" value="14.81"> 러시아 루블 RUB </option> <option label="1" value="3.68"> 헝가리 포린트 HUF </option> <option label="1" value="289.02"> 폴란드 즈워티 PLN </option> </select> <div class="selectbox-box" onclick="clickcr(this, 'exl*c.clist1', '', '', event);"> <div class="selectbox-label"> </div> </div> <div class="selectbox-layer ly_calculator"> <div class="selectbox-list"> </div> </div> </div> <div class="input_area" id="input_from"> <input id="input_from_money" maxlength="10" onclick="clickcr(this, 'exl*c.unit1', '', '', event);" onfocus="changeActiveInput('from', 'to'); return false;" onkeyup="calcExchange('from', 'to', 'on', event);" type="text" value="1"/> <img alt="" height="13" id="img_from_monetary" src="https://ssl.pstatic.net/static/nfinance/img_money_USD.gif" width="26"/> </div> </div> <div class="same"> <img alt="" height="15" src="https://ssl.pstatic.net/static/nfinance/ico_same.gif" width="28"/> </div> <div class="view"> <div class="selectbox-noscript" id="sView"> <select class="selectbox-source" id="select_to"> <option class="selectbox-default" label="1" value="1"> 대한민국 원 KRW </option> <option label="1" value="1"> 대한민국 원 KRW </option> <option label="1" value="1129.0"> 미국 달러 USD </option> <option label="1" value="1329.74"> 유럽연합 유로 EUR </option> <option label="100" value="10.2163"> 일본 엔 JPY </option> <option label="1" value="171.8"> 중국 위안 CNY </option> <option label="1" value="145.2"> 홍콩 달러 HKD </option> <option label="1" value="39.61"> 대만 달러 TWD </option> <option label="1" value="1562.48"> 영국 파운드 GBP </option> <option label="1" value="2932.47"> 오만 리알 OMR </option> <option label="1" value="899.39"> 캐나다 달러 CAD </option> <option label="1" value="1200.17"> 스위스 프랑 CHF </option> <option label="1" value="129.53"> 스웨덴 크로나 SEK </option> <option label="1" value="860.13"> 호주 달러 AUD </option> <option label="1" value="793.8"> 뉴질랜드 달러 NZD </option> <option label="1" value="50.96"> 체코 코루나 CZK </option> <option label="1" value="1.57"> 칠레 페소 CLP </option> <option label="1" value="140.14"> 터키 리라 TRY </option> <option label="1" value="0.4"> 몽골 투그릭 MNT </option> <option label="1" value="339.44"> 이스라엘 세켈 ILS </option> <option label="1" value="178.77"> 덴마크 크로네 DKK </option> <option label="1" value="132.39"> 노르웨이 크로네 NOK </option> <option label="1" value="301.03"> 사우디아라비아 리얄 SAR </option> <option label="1" value="3737.17"> 쿠웨이트 디나르 KWD </option> <option label="1" value="2994.06"> 바레인 디나르 BHD </option> <option label="1" value="307.37"> 아랍에미리트 디르함 AED </option> <option label="1" value="1592.38"> 요르단 디나르 JOD </option> <option label="1" value="71.84"> 이집트 파운드 EGP </option> <option label="1" value="36.06"> 태국 바트 THB </option> <option label="1" value="840.06"> 싱가포르 달러 SGD </option> <option label="1" value="272.71"> 말레이시아 링깃 MYR </option> <option label="100" value="0.0779"> 인도네시아 루피아 IDR </option> <option label="1" value="310.08"> 카타르 리얄 QAR </option> <option label="1" value="2.64"> 카자흐스탄 텡게 KZT </option> <option label="1" value="840.06"> 브루나이 달러 BND </option> <option label="1" value="15.39"> 인도 루피 INR </option> <option label="1" value="7.37"> 파키스탄 루피 PKR </option> <option label="1" value="13.32"> 방글라데시 타카 BDT </option> <option label="1" value="23.24"> 필리핀 페소 PHP </option> <option label="1" value="55.66"> 멕시코 페소 MXN </option> <option label="1" value="197.76"> 브라질 레알 BRL </option> <option label="100" value="0.0489"> 베트남 동 VND </option> <option label="1" value="77.18"> 남아프리카 공화국 랜드 ZAR </option> <option label="1" value="14.81"> 러시아 루블 RUB </option> <option label="1" value="3.68"> 헝가리 포린트 HUF </option> <option label="1" value="289.02"> 폴란드 즈워티 PLN </option> </select> <div class="selectbox-box" onclick="clickcr(this, 'exl*c.clist2', '', '', event);"> <div class="selectbox-label"> </div> </div> <div class="selectbox-layer ly_calculator"> <div class="selectbox-list"> </div> </div> </div> <div class="input_area" id="input_to"> <input id="input_to_money" maxlength="10" onclick="clickcr(this, 'exl*c.unit2', '', '', event);" onfocus="changeActiveInput('to', 'from'); return false;" onkeyup="calcExchange('to', 'from', 'on', event);" type="text"/> <img alt="" height="13" id="img_to_monetary" src="https://ssl.pstatic.net/static/nfinance/img_money_KRW.gif" width="26"/> </div> </div> </div> </div> </div> <div class="section_exchange"> <div id="section_ex1"> <h3 class="blind" id="exchange1"> 환전 고시 환율 </h3> <div class="exchange_info"> <span class="date"> 2021.04.02 20:01 </span> <span class="standard"> 하나은행 기준 </span> <span class="round"> 고시회차 <em> 214 </em> 회 </span> </div> <iframe frameborder="0" height="1378px" id="frame_ex1" marginheight="0" marginwidth="0" scrolling="no" src="/marketindex/exchangeList.nhn" title="환전 고시 환율" width="100%"> </iframe> </div> <ul class="tbl_info"> <li> 통화명과 심볼은 앞에 위치한 통화에 1이 생략된 형태로, 달러/일본 엔(심볼: USDJPY)인 경우 1 USD(달러)가 JPY(일본 엔)으로 얼마인가를 의미합니다. </li> </ul> </div> <script language="javascript" src="https://ssl.pstatic.net/imgstock/static.pc/20210401112320/js/jindoComponent/jindo.Component.1.0.3.js" type="text/javascript"> </script> <script language="javascript" src="https://ssl.pstatic.net/imgstock/static.pc/20210401112320/js/jindoComponent/jindo.UIComponent.1.0.1.js" type="text/javascript"> </script> <script language="javascript" src="https://ssl.pstatic.net/imgstock/static.pc/20210401112320/js/jindoComponent/jindo.HTMLComponent.1.0.1.js" type="text/javascript"> </script> <script language="javascript" src="https://ssl.pstatic.net/imgstock/static.pc/20210401112320/js/jindoComponent/jindo.Timer.1.0.3.js" type="text/javascript"> </script> <script language="javascript" src="https://ssl.pstatic.net/imgstock/static.pc/20210401112320/js/jindoComponent/jindo.LayerManager.1.0.1.js" type="text/javascript"> </script> <script language="javascript" src="https://ssl.pstatic.net/imgstock/static.pc/20210401112320/js/jindoComponent/jindo.LayerPosition.1.0.1.js" type="text/javascript"> </script> <script language="javascript" src="https://ssl.pstatic.net/imgstock/static.pc/20210401112320/js/jindoComponent/jindo.RolloverArea.1.0.1.js" type="text/javascript"> </script> <script language="javascript" src="https://ssl.pstatic.net/imgstock/static.pc/20210401112320/js/jindoComponent/jindo.RolloverClick.1.0.1.js" type="text/javascript"> </script> <script language="javascript" src="https://ssl.pstatic.net/imgstock/static.pc/20210401112320/js/jindoComponent/jindo.SelectBox.1.0.1.js" type="text/javascript"> </script> <script charset="euckr" language="javascript" src="https://ssl.pstatic.net/imgstock/static.pc/20210401112320/js/jindoComponent/jindo.TextRange.1.0.1.js" type="text/javascript"> </script> <script charset="euckr" language="javascript" src="https://ssl.pstatic.net/imgstock/static.pc/20210401112320/js/jindoComponent/jindo.WatchInput.1.0.1.js" type="text/javascript"> </script> <script charset="euckr" language="javascript" src="https://ssl.pstatic.net/imgstock/static.pc/20210401112320/js/jindoComponent/jindo.Formatter.1.1.0.js" type="text/javascript"> </script> <script charset="euckr" language="javascript" src="https://ssl.pstatic.net/imgstock/static.pc/20210401112320/js/jindoComponent/jindo.NumberFormatter.1.0.1.js" type="text/javascript"> </script> <script language="javascript" src="https://ssl.pstatic.net/imgstock/static.pc/20210401112320/js/exchange.js" type="text/javascript"> </script> <script type="text/javascript"> // exchangeDetail.jsp에도 동일 스크립트 있음 - 로딩시 디자인이 0.5초간 디자인이 안뜬다는 이슈로 include하지 않고 같은 스크립트를 두벌로 관리함 //환율 계산 function calcExchange(str1, str2, cssOn, event) { var oEvent = event || window.event; var sKeyCode = (undefined === oEvent) ? undefined : jindo.$Event(oEvent).key().keyCode; if (sKeyCode != 13 && sKeyCode != 27 && sKeyCode != 37 && sKeyCode != 38 && sKeyCode != 110 && sKeyCode != 229) { if (str1 == '' && str2 == '') { if (jindo.$('input_to').className == 'input_area') { str1 = 'from'; str2 = 'to'; } else { str1 = 'to'; str2 = 'from'; } } var regExp = new RegExp("[^0-9\.\,]"); var sInputValue = jindo.$('input_' + str1 + '_money').value; if(regExp.test(sInputValue)){ alert('숫자, 소수점(.)만 입력하실 수 있습니다.'); jindo.$('input_' + str1 + '_money').value = revertInputText(sInputValue); return false; } // 사용자가 입력한 콤마(,) 제거 if (sInputValue.substr(sInputValue.length - 1, 1) == ',') { jindo.$('input_' + str1 + '_money').value = revertInputText(sInputValue); return false; } // 맨 앞에 있는 숫자 0 없애기 if (sInputValue == '0' || sInputValue == '.' || sInputValue == ',') { jindo.$('input_' + str1 + '_money').value = revertInputText(sInputValue); return false; } // 소수점 2개가 없도록 var match = sInputValue.match(/\./g); if (match != null && match.length >= 2) { jindo.$('input_' + str1 + '_money').value = revertInputText(sInputValue); return false; } // 소수점을 입력한 경우, 일단 대기 var pointPosIndex = sInputValue.indexOf('.'); if (pointPosIndex != -1 && pointPosIndex == sInputValue.length - 1) { return false; } // 소수점 2자리 유지 if (pointPosIndex != -1 && sInputValue.substring(pointPosIndex + 1, sInputValue.length).length > 2) { jindo.$('input_' + str1 + '_money').value = revertInputText(sInputValue); return false; } var e_select_from = jindo.$('select_'+str1); var e_select_to = jindo.$('select_'+str2); var input_from_money = jindo.$('input_'+str1+'_money').value ; var input_from = e_select_from.options[e_select_from.selectedIndex].value ; var input_to = e_select_to.options[e_select_to.selectedIndex].value ; var unit_from = e_select_from.options[e_select_from.selectedIndex].text ; var unit_to = e_select_to.options[e_select_to.selectedIndex].text ; input_from_money = input_from_money.replace(/ |,|\t/g, "") ; input_from = input_from.replace(/ |,|\t/g, "") ; input_to = input_to.replace(/ |,|\t/g, "") ; unit_from = unit_from.substr(unit_from.length-3, 3); unit_to = unit_to.substr(unit_to.length-3, 3); var str1_result = input_from_money * 1 ; var str1_str = str1_result.toFixed(0) ; var str1_len = str1_str.length ; var str1_result_str = new String("") ; if(str1_str > str1_result) str1_str = new String(str1_str-1) ; if (str1_len >= 3) { for (i = str1_len - 3; i > 0; i-=3) str1_result_str = "," + str1_str.substr(i, 3) + str1_result_str ; str1_result_str = str1_str.substr(0, 3+i) + str1_result_str ; for (var i=0; i<input_from_money.length; i++) { if (input_from_money.substr(i,1) != '0') { input_from_money = input_from_money.substring(i,input_from_money.length) ; break; } } if (str1_str != input_from_money) { str1_result_str += str1_result.toFixed(input_from_money.split(".")[1].length).substr(str1_len, input_from_money.split(".")[1].length + 1) ; } } else str1_result_str = input_from_money ; var str2_result = input_from_money * input_from / input_to ; var str2_str = str2_result.toFixed(0) ; var str2_len = str2_str.length ; var str2_result_str = new String("") ; if (str2_str > str2_result) str2_str = new String(str2_str-1) ; if (str2_len >= 3) { for (i = str2_len - 3; i > 0; i-=3) str2_result_str = "," + str2_str.substr(i, 3) + str2_result_str ; str2_result_str = str2_str.substr(0, 3+i) + str2_result_str ; str2_result_str += str2_result.toFixed(2).substr(str2_len, 3) ; } else str2_result_str = str2_result.toFixed(2) ; jindo.$('input_'+str1+'_money').value = str1_result_str; jindo.$('input_'+str2+'_money').value = str2_result_str; jindo.$('img_'+str1+'_monetary').src = "https://ssl.pstatic.net/static/nfinance/img_money_"+unit_from+".gif"; jindo.$('img_'+str2+'_monetary').src = "https://ssl.pstatic.net/static/nfinance/img_money_"+unit_to+".gif"; jindo.$Element(jindo.$('input_'+str1)).addClass("on"); jindo.$Element(jindo.$('input_'+str2)).removeClass("on"); if (cssOn == "off"){ jindo.$Element(jindo.$('input_'+str1)).removeClass("on"); } } } function revertInputText(sOrgText) { var sResult = sOrgText; if (sOrgText != '') { sResult = sOrgText.substr(0, sOrgText.length - 1); } return sResult; } jindo.$Fn(function(){ chartMouseOverEvent('exchangeList'); }).attach(document, "domready"); </script> </div> <script language="javascript" src="https://ssl.pstatic.net/imgstock/static.pc/20210401112320/js/jindo_ellipse.js"> </script> <script language="javascript" src="https://ssl.pstatic.net/imgstock/static.pc/20210401112320/js/util.js"> </script> <script type="text/javascript"> function ellipseTopNewsTitle() { jindo.EllipseText.factory(jindo.$$(".news_list ul li"), {nAssistWidth: 10}); } var basicDates; function initDate() { basicDates = jindo.$H(); basicDates.add('', ''); basicDates.add('', ''); basicDates.add('', ''); basicDates.add('', ''); basicDates.add('', ''); basicDates.add('', ''); } var basicDescriptions; function initDescription() { basicDescriptions = jindo.$H(); basicDescriptions.add('CMDT_CDY','<em></em> 기준<span>단위:</span>'); basicDescriptions.add('CMDT_PDY','<em></em> 기준<span>단위:</span>'); basicDescriptions.add('CMDT_NG','<em></em> 기준<span>단위:</span>'); basicDescriptions.add('CMDT_S','<em></em> 기준<span>단위:</span>'); basicDescriptions.add('CMDT_C','<em></em> 기준<span>단위:</span>'); basicDescriptions.add('CMDT_SB','<em></em> 기준<span>단위:</span>'); } function setEvent(num, imgChartUrl){ var parentElemnt = jindo.$$('.tbl_market')[num]; var elementList = jindo.$$('tr',parentElemnt); jindo.$Fn(function(e){ var elementListSize = elementList.length; for(var i = 0 ; i < elementListSize ; i ++) { var selectedElement = jindo.$Element(elementList[i]); var selectedClassName = selectedElement.className(); if (selectedClassName != "") { selectedElement.removeClass(selectedClassName); selectedElement.addClass(selectedClassName.replace("on","")); } } var ele = jindo.$Element(jindo.$Event(e).currentElement); var linkUrl = jindo.$$.getSingle('a' , ele.$value()).href; var marketindexCd = linkUrl.split('=')[1]; var className = ele.className(); ele.removeClass(className); ele.addClass(className+" on"); var graphElement = jindo.$Element(jindo.$$('.thum')[num]); graphElement.html('<a href=\"'+linkUrl+'\"><img src=\"https://ssl.pstatic.net/imgfinance/chart/marketindex/' + marketindexCd + '.png\" width=\"295\" height=\"153\" alt=""></a>'); if (basicDates.hasKey(marketindexCd)) { jindo.$Element("basicDate").text(basicDates.$(marketindexCd)); } if (basicDescriptions.hasKey(marketindexCd)) { jindo.$Element("basicDescription").html(basicDescriptions.$(marketindexCd)); } }).attach(elementList, "mouseover"); } jindo.$Fn(function(){ initDate(); initDescription(); chartMouseOverEvent('exchangeList'); chartMouseOverEvent('worldExchangeList'); chartMouseOverEvent('oilGoldList'); jindo.$$('title')[0].innerHTML = "시장지표 : 네이버 금융"; }).attach(document, "domready"); </script> <div class="aside" id="marketindex_aside"> <div class="section_aside"> <h3 class="h_interest"> <span> 국내시장금리 </span> </h3> <table class="tbl_exchange market" summary="국제시장 환율 리스트"> <caption> 국내시장금리 </caption> <colgroup> <col width="94"/> <col width="50"/> <col width="75"/> </colgroup> <thead> <tr> <th> 구분 </th> <th> 금리 </th> <th> 등락율 </th> </tr> </thead> <tbody> <tr class="same"> <th class="th_inter4"> <a href="/marketindex/interestDetail.nhn?marketindexCd=IRR_CD91" onclick="clickcr(this, 'rid.local', 'IRR_CD91', '1', event);"> <span> CD금리(91일) </span> </a> </th> <td> 0.75 </td> <td> <img alt="보합" height="6" src="https://ssl.pstatic.net/static/nfinance/ico_same2.gif" width="7"/> 0.00 </td> </tr> <tr class="down"> <th class="th_inter1"> <a href="/marketindex/interestDetail.nhn?marketindexCd=IRR_CALL" onclick="clickcr(this, 'met.8', 'IRR_CALL', '2', event);"> <span> 콜 금리 </span> </a> </th> <td> 0.45 </td> <td> <img alt="하락" height="6" src="https://ssl.pstatic.net/static/nfinance/ico_down.gif" width="7"/> 0.14 </td> </tr> <tr class="up"> <th class="th_inter2"> <a href="/marketindex/interestDetail.nhn?marketindexCd=IRR_GOVT03Y" onclick="clickcr(this, 'met.8', 'IRR_GOVT03Y', '3', event);"> <span> 국고채 (3년) </span> </a> </th> <td> 1.15 </td> <td> <img alt="상승" height="6" src="https://ssl.pstatic.net/static/nfinance/ico_up.gif" width="7"/> 0.02 </td> </tr> <tr class="same"> <th class="th_inter3"> <a href="/marketindex/interestDetail.nhn?marketindexCd=IRR_CORP03Y" onclick="clickcr(this, 'met.8', 'IRR_CORP03Y', '4', event);"> <span> 회사채 (3년) </span> </a> </th> <td> 2.06 </td> <td> <img alt="보합" height="6" src="https://ssl.pstatic.net/static/nfinance/ico_same2.gif" width="7"/> 0.00 </td> </tr> <tr class="down"> <th class="th_inter5"> <a href="/marketindex/interestDetail.nhn?marketindexCd=IRR_COFIXBAL" onclick="clickcr(this, 'met.8', 'IRR_COFIXBAL', '5', event);"> <span> COFIX 잔액 </span> </a> </th> <td> 1.09 </td> <td> <img alt="하락" height="6" src="https://ssl.pstatic.net/static/nfinance/ico_down.gif" width="7"/> 0.04 </td> </tr> <tr class="down"> <th class="th_inter6"> <a href="/marketindex/interestDetail.nhn?marketindexCd=IRR_COFIXNEW" onclick="clickcr(this, 'met.8', 'IRR_COFIXNEW', '6', event);"> <span> COFIX 신규취급액 </span> </a> </th> <td> 0.83 </td> <td> <img alt="하락" height="6" src="https://ssl.pstatic.net/static/nfinance/ico_down.gif" width="7"/> 0.03 </td> </tr> </tbody> </table> <table class="tbl_exchange tbl_exchange_v1 market" style="margin-top:10px;" summary="달러 인덱스"> <caption> 달러 인덱스 </caption> <colgroup> <col width="88"/> <col width="46"/> <col width="66"/> </colgroup> <thead> <tr> <th> 구분 </th> <th> 금리 </th> <th> 등락율 </th> </tr> </thead> <tbody> <tr class="other_t1 down"> <th class="th_inter7"> <a href="/marketindex/worldExchangeDetail.nhn?marketindexCd=FX_USDX&fdtc=4" onclick="clickcr(this, 'rid.dollar', 'FX_USDX', '', event);"> <span> 달러 인덱스 </span> </a> </th> <td> 92.9400 </td> <td> <img alt="하락" height="6" src="https://ssl.pstatic.net/static/nfinance/ico_down.gif" width="7"/> 0.2900 </td> </tr> </tbody> </table> </div> <div class="section_aside"> <div class="tab_search search3"> <a href="#" onclick="clickcr(this, 'rch.1', '', '', event); return false;"> <span> 최근조회 </span> </a> <a href="#" onclick="clickcr(this, 'rch.3', '', '', event); return false;"> <span> MY STOCK </span> </a> </div> <h3 class="blind"> 최근조회 </h3> <table class="tbl_search" summary="최근조회 리스트"> <caption> 최근조회 </caption> <colgroup> <col/> <col width="55"/> <col width="87"/> </colgroup> <thead> <tr> <th> 업체명 </th> <th> 거래량 </th> <th> 전일비 </th> </tr> </thead> <tbody> </tbody> </table> <div class="more_info"> <span> <a href="#" onclick="clickcr(this, 'rch.5', '', '', event); return false;"> <img alt="이전" height="15" src="https://ssl.pstatic.net/static/nfinance/btn_prev2.gif" width="17"/> </a> <a href="#" onclick="clickcr(this, 'rch.6', '', '', event); return false;"> <img alt="다음" height="15" src="https://ssl.pstatic.net/static/nfinance/btn_next2.gif" width="17"/> </a> </span> <a class="btn_more _mystock_more_info" href="#" onclick="javascript:openMyitemNew('https://finance.naver.com'); clickcr(this, 'rch.7', '', '', event);"> <img alt="더보기" height="10" src="https://ssl.pstatic.net/static/nfinance/btn_more5.gif" width="33"/> </a> </div> </div> <div class="section_aside"> <h3 class="h_report"> <span> 경제분석 리포트 </span> </h3> <ul class="list_report"> <li> <a href="/research/economy_read.nhn?nid=7183" onclick="clickcr(this, 'rer.list', '', '', event);"> 4월 수급주의보 </a> </li> <li> <a href="/research/economy_read.nhn?nid=7182" onclick="clickcr(this, 'rer.list', '', '', event);"> 국내외 경제이슈 </a> </li> <li> <a href="/research/economy_read.nhn?nid=7181" onclick="clickcr(this, 'rer.list', '', '', event);"> 국내외 경제이슈 </a> </li> <li> <a href="/research/economy_read.nhn?nid=7180" onclick="clickcr(this, 'rer.list', '', '', event);"> 국내외 경제이슈 </a> </li> <li> <a href="/research/economy_read.nhn?nid=7179" onclick="clickcr(this, 'rer.list', '', '', event);"> 회복되는 경기와 불안한 시장 </a> </li> </ul> <a class="btn_more" href="/research/economy_list.nhn" onclick="clickcr(this, 'rer.more', '', '', event);"> <img alt="경제분석 리포트 더보기" height="18" src="https://ssl.pstatic.net/static/nfinance/btn_more.gif" width="34"/> </a> </div> </div> <script language="javascript" src="https://ssl.pstatic.net/imgstock/static.pc/20210401112320/js/info/myStock.js" type="text/javascript"> </script> <script language="javascript" src="https://ssl.pstatic.net/imgstock/static.pc/20210401112320/js/util.js" type="text/javascript"> </script> <script language="javascript"> function toggleTabSearch(e){ var currentElement = jindo.$Element(jindo.$Event(e).currentElement); var parentElement = currentElement.parent(); var id = currentElement.className(); var order = parentElement.indexOf(currentElement) + 3; parentElement.className("tab_search search"+ order); // 페이징을 위해서 order값에 따라 최근조회인지 mystock인지 type을 저장 if (order == 3) { currentType = "recent"; } else { currentType = "mystock"; } } jindo.$Fn(function(){ if ('true' == 'true') { getStockRightMenuData('000000', 'recent', 1, 'https://finance.naver.com', 'https://ssl.pstatic.net/static/nfinance'); var tabSearchArea = jindo.$$.getSingle('.tab_search'); var moreInfoArea = jindo.$Element(jindo.$$.getSingle('.tbl_search')).next().$value(); jindo.$Fn(function(e) {toggleTabSearch(e); getStockRightMenuData('000000', 'recent', 1, 'https://finance.naver.com', 'https://ssl.pstatic.net/static/nfinance'); }).attach(jindo.$$.getSingle('a' ,tabSearchArea), 'click'); jindo.$Fn(function(e) {toggleTabSearch(e); getStockRightMenuData('000000', 'mystock', 1, 'https://finance.naver.com', 'https://ssl.pstatic.net/static/nfinance'); }).attach(jindo.$$('a' ,tabSearchArea)[1], 'click'); jindo.$Fn(function(e) {updatePageForPaging (currentType, 'up', 'https://finance.naver.com', 'https://ssl.pstatic.net/static/nfinance'); }).attach(jindo.$$.getSingle('a', moreInfoArea), 'click'); jindo.$Fn(function(e) {updatePageForPaging (currentType, 'down', 'https://finance.naver.com', 'https://ssl.pstatic.net/static/nfinance'); }).attach(jindo.$$('a', moreInfoArea)[1], 'click'); } }).attach(document,"domready"); function openMyitemNew(stockHost) { var selectedElement = jindo.$Element(jindo.$$.getSingle(".tab_search")); if (selectedElement != null) { if (selectedElement.hasClass("search1")) { document.location.href = stockHost + '/mystock/recentSearchItemList.nhn'; } else { document.location.href = stockHost + '/mystock/itemList.nhn'; } } } </script> </div> <div id="footer"> <ul> <li class="first"> <a href="https://www.naver.com/rules/service.html" onclick="clickcr(this, 'fot.service', '', '', event);" target="_blank"> 이용약관 </a> </li> <li> <a href="/rules.nhn" onclick="clickcr(this, 'fot.policy', '', '', event);" target="_blank"> 금융게시판 운영원칙 </a> </li> <li> <a href="https://www.naver.com/rules/privacy.html" onclick="clickcr(this, 'fot.privacy', '', '', event);" target="_blank"> <strong> 개인정보처리방침 </strong> </a> </li> <li> <a href="https://www.naver.com/rules/disclaimer.html" onclick="clickcr(this, 'fot.limit', '', '', event);" target="_blank"> 책임의 한계와 법적고지 </a> </li> <li> <a href="https://help.naver.com/support/alias/contents2/finance/finance_1.naver" onclick="clickcr(this, 'fot.help', '', '', event);" target="_blank"> 금융 고객센터 </a> </li> </ul> <p class="desc"> 네이버(주)가 제공하는 금융 정보는 각 콘텐츠 제공업체로부터 받는 투자 참고사항이며, 오류가 발생하거나 지연될 수 있습니다. <br/> 네이버(주)와 콘텐츠 제공업체는 제공된 정보에 의한 투자 결과에 법적인 책임을 지지 않습니다. 게시된 정보는 무단으로 배포할 수 없습니다. </p> <address> <a class="logo" href="https://www.navercorp.com/" onclick="clickcr(this, 'fot.nhn', '', '', event);" target="_blank"> <img alt="NAVER" height="11" src="https://ssl.pstatic.net/static/nfinance/2019/02/22/ci_naver.png" width="58"/> </a> <em> Copyright © </em> <a href="https://www.navercorp.com/" onclick="clickcr(this, 'fot.nhn', '', '', event);" target="_blank"> NAVER Corp. </a> <span> All Rights Reserved. </span> </address> </div> <script type="text/javascript"> function isVisible(obj) { if (obj == document) return true if (!obj) return false if (!obj.parentNode) return false if (obj.style) { if (obj.style.display == 'none') return false if (obj.style.visibility == 'hidden') return false } if (window.getComputedStyle) { var style = window.getComputedStyle(obj, "") if (style.display == 'none') return false if (style.visibility == 'hidden') return false } var style = obj.currentStyle if (style) { if (style['display'] == 'none') return false if (style['visibility'] == 'hidden') return false } return isVisible(obj.parentNode) } function isChildOf(myobj, containerObj) { while(myobj != undefined) { if (myobj == document.body) { break; } if (myobj == containerObj) { return true; } myobj = myobj.parentElement; } return false; } function gnbLayerClose(e){ var target = e.target ? e.target : e.srcElement; if (isVisible(document.getElementById('gnb_service_lyr')) || isVisible(document.getElementById('gnb_notice_lyr')) ||isVisible(document.getElementById('gnb_my_lyr')) ) { if (!isChildOf(target, document.getElementById('gnb'))) { gnbAllLayerClose(); } } } var isIE = (navigator.userAgent.toLowerCase().indexOf("msie")!=-1 && window.document.all) ? true:false; if (isIE) { document.attachEvent('onmousedown', gnbLayerClose); } else { window.addEventListener('mousedown', gnbLayerClose); } </script>
해당 페이지를 읽어온다. prettify()로 print()를 해도 사실 확인하기는 쉽지 않다.
soup.find_all('span','value')[0].string
'1,129.00'
혹시 몰라서 find_all로 찾고 리스트로 결과가 반환되니까 첫 번째를 선택하자.
3-3 실전 : 시카고 샌드위치 맛집 소개 사이트에 접근하기¶
이제 시카고의 베스트 샌드위치 가게를 소개하고 시카고 매거진 홈페이지에 접속하여 샌드위치 가게 정보를 얻어오자.
일단 접속 주소는 http://goo.go/wAtvls 이다.
import requests
from bs4 import BeautifulSoup
from urllib.request import urlopen
headers = {'User-Agent': 'Mozilla/5.0'}
url = 'http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-Chicago/'
res = requests.get(url, headers=headers)
soup = BeautifulSoup(res.text)
soup
<!DOCTYPE html> <html lang="en-US"> <head> <meta charset="utf-8"/> <meta content="IE=edge" http-equiv="X-UA-Compatible"> <link href="https://gmpg.org/xfn/11" rel="profile"/> <title>The 50 Best Sandwiches in Chicago – Chicago Magazine</title> <style type="text/css"> .heateorSssInstagramBackground{background:radial-gradient(circle at 30% 107%,#fdf497 0,#fdf497 5%,#fd5949 45%,#d6249f 60%,#285aeb 90%)} div.heateor_sss_horizontal_sharing i.heateorSssInstagramBackground{background:#000!important;}div.heateor_sss_standard_follow_icons_container i.heateorSssInstagramBackground{background:#000;} .heateor_sss_horizontal_sharing .heateorSssSharing,.heateor_sss_standard_follow_icons_container .heateorSssSharing{ background-color: #000; color: #fff; border-width: 0px; border-style: solid; border-color: transparent; } .heateor_sss_horizontal_sharing .heateorSssTCBackground{ color:#666; } .heateor_sss_horizontal_sharing .heateorSssSharing:hover,.heateor_sss_standard_follow_icons_container .heateorSssSharing:hover{ border-color: transparent; } .heateor_sss_vertical_sharing .heateorSssSharing,.heateor_sss_floating_follow_icons_container .heateorSssSharing{ color: #fff; border-width: 0px; border-style: solid; border-color: transparent; } .heateor_sss_vertical_sharing .heateorSssTCBackground{ color:#666; } .heateor_sss_vertical_sharing .heateorSssSharing:hover,.heateor_sss_floating_follow_icons_container .heateorSssSharing:hover{ border-color: transparent; } @media screen and (max-width:783px) {.heateor_sss_vertical_sharing{display:none!important}}@media screen and (max-width:783px) {.heateor_sss_floating_follow_icons_container{display:none!important}}</style><link href="//use.fontawesome.com" rel="dns-prefetch"> <link href="//s.w.org" rel="dns-prefetch"/> <link href="https://www.chicagomag.com/feed/" rel="alternate" title="Chicago Magazine » Feed" type="application/rss+xml"/> <link href="https://www.chicagomag.com/comments/feed/" rel="alternate" title="Chicago Magazine » Comments Feed" type="application/rss+xml"/> <link href="https://www.chicagomag.com/chicago-magazine/november-2012/best-sandwiches-chicago/feed/" rel="alternate" title="Chicago Magazine » The 50 Best Sandwiches in Chicago Comments Feed" type="application/rss+xml"/> <script> window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/13.0.1\/72x72\/","ext":".png","svgUrl":"https:\/\/s.w.org\/images\/core\/emoji\/13.0.1\/svg\/","svgExt":".svg","source":{"concatemoji":"https:\/\/www.chicagomag.com\/wp-includes\/js\/wp-emoji-release.min.js?ver=5.6"}}; !function(e,a,t){var r,n,o,i,p=a.createElement("canvas"),s=p.getContext&&p.getContext("2d");function c(e,t){var a=String.fromCharCode;s.clearRect(0,0,p.width,p.height),s.fillText(a.apply(this,e),0,0);var r=p.toDataURL();return s.clearRect(0,0,p.width,p.height),s.fillText(a.apply(this,t),0,0),r===p.toDataURL()}function l(e){if(!s||!s.fillText)return!1;switch(s.textBaseline="top",s.font="600 32px Arial",e){case"flag":return!c([127987,65039,8205,9895,65039],[127987,65039,8203,9895,65039])&&(!c([55356,56826,55356,56819],[55356,56826,8203,55356,56819])&&!c([55356,57332,56128,56423,56128,56418,56128,56421,56128,56430,56128,56423,56128,56447],[55356,57332,8203,56128,56423,8203,56128,56418,8203,56128,56421,8203,56128,56430,8203,56128,56423,8203,56128,56447]));case"emoji":return!c([55357,56424,8205,55356,57212],[55357,56424,8203,55356,57212])}return!1}function d(e){var t=a.createElement("script");t.src=e,t.defer=t.type="text/javascript",a.getElementsByTagName("head")[0].appendChild(t)}for(i=Array("flag","emoji"),t.supports={everything:!0,everythingExceptFlag:!0},o=0;o<i.length;o++)t.supports[i[o]]=l(i[o]),t.supports.everything=t.supports.everything&&t.supports[i[o]],"flag"!==i[o]&&(t.supports.everythingExceptFlag=t.supports.everythingExceptFlag&&t.supports[i[o]]);t.supports.everythingExceptFlag=t.supports.everythingExceptFlag&&!t.supports.flag,t.DOMReady=!1,t.readyCallback=function(){t.DOMReady=!0},t.supports.everything||(n=function(){t.readyCallback()},a.addEventListener?(a.addEventListener("DOMContentLoaded",n,!1),e.addEventListener("load",n,!1)):(e.attachEvent("onload",n),a.attachEvent("onreadystatechange",function(){"complete"===a.readyState&&t.readyCallback()})),(r=t.source||{}).concatemoji?d(r.concatemoji):r.wpemoji&&r.twemoji&&(d(r.twemoji),d(r.wpemoji)))}(window,document,window._wpemojiSettings); </script> <style> img.wp-smiley, img.emoji { display: inline !important; border: none !important; box-shadow: none !important; height: 1em !important; width: 1em !important; margin: 0 .07em !important; vertical-align: -0.1em !important; background: none !important; padding: 0 !important; } </style> <link href="https://www.chicagomag.com/wp-includes/css/dist/block-library/style.min.css?ver=5.6" id="wp-block-library-css" media="all" rel="stylesheet"/> <link href="https://www.chicagomag.com/wp-content/plugins/wordpress-popular-posts/assets/css/wpp.css?ver=5.2.4" id="wordpress-popular-posts-css-css" media="all" rel="stylesheet"/> <link href="//use.fontawesome.com/releases/v5.13.0/css/all.css?ver=5.6" id="font-awesome-free-css" media="all" rel="stylesheet"/> <link href="https://www.chicagomag.com/wp-content/themes/generatepress/assets/css/unsemantic-grid.min.css?ver=3.0.2" id="generate-style-grid-css" media="all" rel="stylesheet"/> <link href="https://www.chicagomag.com/wp-content/themes/generatepress/assets/css/style.min.css?ver=3.0.2" id="generate-style-css" media="all" rel="stylesheet"/> <style id="generate-style-inline-css"> body{background-color:#efefef;color:#3a3a3a;}a{color:#1e73be;}a:hover, a:focus, a:active{color:#000000;}body .grid-container{max-width:1100px;}.wp-block-group__inner-container{max-width:1100px;margin-left:auto;margin-right:auto;}body, button, input, select, textarea{font-family:-apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";}body{line-height:1.5;}.entry-content > [class*="wp-block-"]:not(:last-child){margin-bottom:1.5em;}.main-title{font-size:45px;}.main-navigation .main-nav ul ul li a{font-size:14px;}.sidebar .widget, .footer-widgets .widget{font-size:17px;}h1{font-weight:300;font-size:40px;}h2{font-weight:300;font-size:30px;}h3{font-size:20px;}h4{font-size:inherit;}h5{font-size:inherit;}@media (max-width:768px){.main-title{font-size:30px;}h1{font-size:30px;}h2{font-size:25px;}}.top-bar{background-color:#636363;color:#ffffff;}.top-bar a{color:#ffffff;}.top-bar a:hover{color:#303030;}.site-header{background-color:#ffffff;color:#3a3a3a;}.site-header a{color:#3a3a3a;}.main-title a,.main-title a:hover{color:#222222;}.site-description{color:#757575;}.main-navigation,.main-navigation ul ul{background-color:#222222;}.main-navigation .main-nav ul li a,.menu-toggle, .main-navigation .menu-bar-items{color:#ffffff;}.main-navigation .main-nav ul li:hover > a,.main-navigation .main-nav ul li:focus > a, .main-navigation .main-nav ul li.sfHover > a, .main-navigation .menu-bar-item:hover > a, .main-navigation .menu-bar-item.sfHover > a{color:#ffffff;background-color:#3f3f3f;}button.menu-toggle:hover,button.menu-toggle:focus,.main-navigation .mobile-bar-items a,.main-navigation .mobile-bar-items a:hover,.main-navigation .mobile-bar-items a:focus{color:#ffffff;}.main-navigation .main-nav ul li[class*="current-menu-"] > a{color:#ffffff;background-color:#3f3f3f;}.main-navigation .main-nav ul li[class*="current-menu-"] > a:hover,.main-navigation .main-nav ul li[class*="current-menu-"].sfHover > a{color:#ffffff;background-color:#3f3f3f;}.navigation-search input[type="search"],.navigation-search input[type="search"]:active, .navigation-search input[type="search"]:focus, .main-navigation .main-nav ul li.search-item.active > a, .main-navigation .menu-bar-items .search-item.active > a{color:#ffffff;background-color:#3f3f3f;}.main-navigation ul ul{background-color:#3f3f3f;}.main-navigation .main-nav ul ul li a{color:#ffffff;}.main-navigation .main-nav ul ul li:hover > a,.main-navigation .main-nav ul ul li:focus > a,.main-navigation .main-nav ul ul li.sfHover > a{color:#ffffff;background-color:#4f4f4f;}.main-navigation .main-nav ul ul li[class*="current-menu-"] > a{color:#ffffff;background-color:#4f4f4f;}.main-navigation .main-nav ul ul li[class*="current-menu-"] > a:hover,.main-navigation .main-nav ul ul li[class*="current-menu-"].sfHover > a{color:#ffffff;background-color:#4f4f4f;}.separate-containers .inside-article, .separate-containers .comments-area, .separate-containers .page-header, .one-container .container, .separate-containers .paging-navigation, .inside-page-header{background-color:#ffffff;}.entry-meta{color:#595959;}.entry-meta a{color:#595959;}.entry-meta a:hover{color:#1e73be;}.sidebar .widget{background-color:#ffffff;}.sidebar .widget .widget-title{color:#000000;}.footer-widgets{background-color:#ffffff;}.footer-widgets .widget-title{color:#000000;}.site-info{color:#ffffff;background-color:#222222;}.site-info a{color:#ffffff;}.site-info a:hover{color:#606060;}.footer-bar .widget_nav_menu .current-menu-item a{color:#606060;}input[type="text"],input[type="email"],input[type="url"],input[type="password"],input[type="search"],input[type="tel"],input[type="number"],textarea,select{color:#666666;background-color:#fafafa;border-color:#cccccc;}input[type="text"]:focus,input[type="email"]:focus,input[type="url"]:focus,input[type="password"]:focus,input[type="search"]:focus,input[type="tel"]:focus,input[type="number"]:focus,textarea:focus,select:focus{color:#666666;background-color:#ffffff;border-color:#bfbfbf;}button,html input[type="button"],input[type="reset"],input[type="submit"],a.button,a.wp-block-button__link:not(.has-background){color:#ffffff;background-color:#666666;}button:hover,html input[type="button"]:hover,input[type="reset"]:hover,input[type="submit"]:hover,a.button:hover,button:focus,html input[type="button"]:focus,input[type="reset"]:focus,input[type="submit"]:focus,a.button:focus,a.wp-block-button__link:not(.has-background):active,a.wp-block-button__link:not(.has-background):focus,a.wp-block-button__link:not(.has-background):hover{color:#ffffff;background-color:#3f3f3f;}a.generate-back-to-top{background-color:rgba( 0,0,0,0.4 );color:#ffffff;}a.generate-back-to-top:hover,a.generate-back-to-top:focus{background-color:rgba( 0,0,0,0.6 );color:#ffffff;}@media (max-width:768px){.main-navigation .menu-bar-item:hover > a, .main-navigation .menu-bar-item.sfHover > a{background:none;color:#ffffff;}}.inside-top-bar{padding:10px;}.inside-header{padding:40px;}.entry-content .alignwide, body:not(.no-sidebar) .entry-content .alignfull{margin-left:-40px;width:calc(100% + 80px);max-width:calc(100% + 80px);}.rtl .menu-item-has-children .dropdown-menu-toggle{padding-left:20px;}.rtl .main-navigation .main-nav ul li.menu-item-has-children > a{padding-right:20px;}.site-info{padding:20px;}@media (max-width:768px){.separate-containers .inside-article, .separate-containers .comments-area, .separate-containers .page-header, .separate-containers .paging-navigation, .one-container .site-content, .inside-page-header, .wp-block-group__inner-container{padding:30px;}.site-info{padding-right:10px;padding-left:10px;}.entry-content .alignwide, body:not(.no-sidebar) .entry-content .alignfull{margin-left:-30px;width:calc(100% + 60px);max-width:calc(100% + 60px);}}.one-container .sidebar .widget{padding:0px;}@media (max-width:768px){.main-navigation .menu-toggle,.main-navigation .mobile-bar-items,.sidebar-nav-mobile:not(#sticky-placeholder){display:block;}.main-navigation ul,.gen-sidebar-nav{display:none;}[class*="nav-float-"] .site-header .inside-header > *{float:none;clear:both;}} </style> <link href="https://www.chicagomag.com/wp-content/themes/generatepress/assets/css/mobile.min.css?ver=3.0.2" id="generate-mobile-style-css" media="all" rel="stylesheet"/> <link href="https://www.chicagomag.com/wp-content/themes/generatepress/assets/css/components/font-icons.min.css?ver=3.0.2" id="generate-font-icons-css" media="all" rel="stylesheet"/> <link href="https://www.chicagomag.com/wp-content/themes/Chicago%20Magazine/style.css?ver=1617134281" id="generate-child-css" media="all" rel="stylesheet"/> <link href="https://www.chicagomag.com/wp-content/plugins/sassy-social-share/public/css/sassy-social-share-public.css?ver=3.3.20" id="heateor_sss_frontend_css-css" media="all" rel="stylesheet"/> <link href="https://www.chicagomag.com/wp-content/plugins/sassy-social-share/admin/css/sassy-social-share-svg.css?ver=3.3.20" id="heateor_sss_sharing_default_svg-css" media="all" rel="stylesheet"/> <link href="https://www.chicagomag.com/wp-content/plugins/youtube-embed-plus-pro/styles/ytprefs.min.css?ver=13.4.2" id="__EPYT__style-css" media="all" rel="stylesheet"/> <style id="__EPYT__style-inline-css"> .epyt-gallery-thumb { width: 33.333%; } @media (min-width:0px) and (max-width: 767px) { .epyt-gallery-rowbreak { display: none; } .epyt-gallery-allthumbs[class*="epyt-cols"] .epyt-gallery-thumb { width: 100% !important; } } </style> <link href="https://www.chicagomag.com/wp-content/plugins/youtube-embed-plus-pro/scripts/lity.min.css?ver=13.4.2" id="__disptype__-css" media="all" rel="stylesheet"/> <script id="wpp-json" type="application/json"> {"sampling_active":0,"sampling_rate":100,"ajax_url":"https:\/\/www.chicagomag.com\/wp-json\/wordpress-popular-posts\/v1\/popular-posts","ID":11772,"token":"6862fde4c7","lang":0,"debug":0} </script> <script id="wpp-js-js" src="https://www.chicagomag.com/wp-content/plugins/wordpress-popular-posts/assets/js/wpp.min.js?ver=5.2.4"></script> <script id="jquery-core-js" src="https://www.chicagomag.com/wp-includes/js/jquery/jquery.min.js?ver=3.5.1"></script> <script id="jquery-migrate-js" src="https://www.chicagomag.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=3.3.2"></script> <script id="__dispload__-js" src="https://www.chicagomag.com/wp-content/plugins/youtube-embed-plus-pro/scripts/lity.min.js?ver=13.4.2"></script> <script id="__ytprefs__-js-extra"> var _EPYT_ = {"ajaxurl":"https:\/\/www.chicagomag.com\/wp-admin\/admin-ajax.php","security":"c89bc8a921","gallery_scrolloffset":"20","eppathtoscripts":"https:\/\/www.chicagomag.com\/wp-content\/plugins\/youtube-embed-plus-pro\/scripts\/","eppath":"https:\/\/www.chicagomag.com\/wp-content\/plugins\/youtube-embed-plus-pro\/","epresponsiveselector":"[\"iframe.__youtube_prefs_widget__\"]","epdovol":"1","version":"13.4.2","evselector":"iframe.__youtube_prefs__[src], iframe[src*=\"youtube.com\/embed\/\"], iframe[src*=\"youtube-nocookie.com\/embed\/\"]","ajax_compat":"","ytapi_load":"light","pause_others":"","stopMobileBuffer":"1","vi_active":"","vi_js_posttypes":[]}; </script> <script id="__ytprefs__-js" src="https://www.chicagomag.com/wp-content/plugins/youtube-embed-plus-pro/scripts/ytprefs.min.js?ver=13.4.2"></script> <link href="https://www.chicagomag.com/wp-json/" rel="https://api.w.org/"/><link href="https://www.chicagomag.com/wp-json/wp/v2/posts/11772" rel="alternate" type="application/json"/><link href="https://www.chicagomag.com/xmlrpc.php?rsd" rel="EditURI" title="RSD" type="application/rsd+xml"/> <link href="https://www.chicagomag.com/wp-includes/wlwmanifest.xml" rel="wlwmanifest" type="application/wlwmanifest+xml"/> <link href="https://www.chicagomag.com/chicago-magazine/november-2012/best-sandwiches-chicago/" rel="canonical"/> <link href="https://www.chicagomag.com/?p=11772" rel="shortlink"/> <link href="https://www.chicagomag.com/wp-json/oembed/1.0/embed?url=https%3A%2F%2Fwww.chicagomag.com%2Fchicago-magazine%2Fnovember-2012%2Fbest-sandwiches-chicago%2F" rel="alternate" type="application/json+oembed"/> <link href="https://www.chicagomag.com/wp-json/oembed/1.0/embed?url=https%3A%2F%2Fwww.chicagomag.com%2Fchicago-magazine%2Fnovember-2012%2Fbest-sandwiches-chicago%2F&format=xml" rel="alternate" type="text/xml+oembed"/> <link href="https://www.chicagomag.com/xmlrpc.php" rel="pingback"/> <meta content="width=device-width, initial-scale=1" name="viewport"/><link href="https://www.chicagomag.com/wp-content/uploads/2021/02/favicon.png" rel="icon" sizes="32x32"> <link href="https://www.chicagomag.com/wp-content/uploads/2021/02/favicon.png" rel="icon" sizes="192x192"/> <link href="https://www.chicagomag.com/wp-content/uploads/2021/02/favicon.png" rel="apple-touch-icon"/> <meta content="https://www.chicagomag.com/wp-content/uploads/2021/02/favicon.png" name="msapplication-TileImage"> <!-- BEGIN Typekit Fonts for WordPress --> <link href="https://use.typekit.net/ukb3erh.css" rel="stylesheet"/> <!-- END Typekit Fonts for WordPress --> <!-- start seo fields --> <meta content="Our list of Chicago’s 50 best sandwiches, ranked in order of deliciousness" name="description"/> <meta content="sandwiches, dining" name="keywords"/> <meta content="en_US" property="og:locale"/> <meta content="article" property="og:type"/> <meta content="The 50 Best Sandwiches in Chicago" property="og:title"/> <meta content="https://www.chicagomag.com/wp-content/archive/Chicago-Magazine/November-2012/Best-Sandwiches-Chicago/sandwich-old-oak.jpg" property="og:image"/> <link href="https://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-Chicago/" rel="canonical"> <meta content="https://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-Chicago/" property="og:url"/> <meta content="Chicago Magazine" property="og:site_name"/> <!--<meta property="article:tag" content="" />--> <meta content="Chicago Magazine" property="article:section"/> <!-- <meta property="article:published_time" content="" /> <meta property="article:modified_time" content="" /> <meta property="og:updated_time" content="" /> --> <meta content="summary_large_image" name="twitter:card"/> <meta content="https://www.chicagomag.com/wp-content/archive/Chicago-Magazine/November-2012/Best-Sandwiches-Chicago/sandwich-old-oak.jpg" name="twitter:image"/> <meta content="Our list of Chicago’s 50 best sandwiches, ranked in order of deliciousness" name="twitter:description"/> <meta content="The 50 Best Sandwiches in Chicago" name="twitter:title"/> <!-- end seo fields --> <!-- GA Google Analytics @ https://m0n.co/ga --> <script async="" src="https://www.googletagmanager.com/gtag/js?id=UA-297666-1"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-297666-1'); </script> <!-- start chartbeat code --> <script type="text/javascript"> (function() { /** CONFIGURATION START **/ var _sf_async_config = window._sf_async_config = (window._sf_async_config || {}); _sf_async_config.uid = 25745; _sf_async_config.domain = 'chicagomag.com'; _sf_async_config.flickerControl = false; _sf_async_config.useCanonical = true; _sf_async_config.useCanonicalDomain = true; _sf_async_config.sections = 'Chicago Magazine'; _sf_async_config.authors = 'Chicago Magazine'; /** CONFIGURATION END **/ function loadChartbeat() { var e = document.createElement('script'); var n = document.getElementsByTagName('script')[0]; e.type = 'text/javascript'; e.async = true; e.src = '//static.chartbeat.com/js/chartbeat.js'; n.parentNode.insertBefore(e, n); } loadChartbeat(); })(); </script> <script async="" src="//static.chartbeat.com/js/chartbeat_mab.js"></script> <!-- end chartbeat code --> <!-- Start GPT Tag --> <script async="" src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script> <!-- noodle nirvana --> <script> window.googletag = window.googletag || {cmd: []}; googletag.cmd.push(function() { googletag.defineSlot('/4011/trb.chicagomag/hp', [[728,90]], 'div-gpt-ad-2789321-1') .setTargeting('pos', ['1']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[728,90]], 'div-gpt-ad-2789321-2') .setTargeting('pos', ['2']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[728,90]], 'div-gpt-ad-2789321-3') .setTargeting('pos', ['3']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[728,90]], 'div-gpt-ad-2789321-4') .setTargeting('pos', ['4']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[728,90]], 'div-gpt-ad-2789321-5') .setTargeting('pos', ['5']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[320,50]], 'div-gpt-ad-2789321-6') .setTargeting('pos', ['1']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[320,50]], 'div-gpt-ad-2789321-7') .setTargeting('pos', ['2']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[320,50]], 'div-gpt-ad-2789321-8') .setTargeting('pos', ['3']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[320,50]], 'div-gpt-ad-2789321-9') .setTargeting('pos', ['4']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[320,50]], 'div-gpt-ad-2789321-10') .setTargeting('pos', ['5']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[300,250]], 'div-gpt-ad-2789321-11') .setTargeting('pos', ['1']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[300,250],[300,600]], 'div-gpt-ad-2789321-12') .setTargeting('pos', ['2']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[300,250]], 'div-gpt-ad-2789321-13') .setTargeting('pos', ['3']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[300,250]], 'div-gpt-ad-2789321-14') .setTargeting('pos', ['4']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[300,250]], 'div-gpt-ad-2789321-15') .setTargeting('pos', ['2']) .addService(googletag.pubads()); googletag.pubads().setTargeting('adcat', ['dining-drinking']); googletag.enableServices(); }); </script> <!-- End GPT Tag --> <!-- below is header style for all pages besides home --> <style> /* logo / nav -------------------------------------------------------------- */ .site-header { width: 18% !important; display: table !important; float: left !important; height: 90px; } .inside-header { display: table-cell !important; vertical-align: bottom !important; padding: 0 !important; padding-left: 5vw !important; } .main-navigation { width: 82% !important; display: table !important; position: relative !important; float: left !important; clear: inherit !important; height: 90px; } .inside-navigation { display: table-cell !important; vertical-align: bottom !important; padding-right: 5vw !important; text-align: right !important; } .main-navigation ul { border: 0 !important; line-height: 1em !important; } .main-navigation .main-nav ul li a { padding-left: 15px !important; padding-right: 15px !important; line-height: 1em !important; } .main-navigation .main-nav ul li:last-of-type a { padding-right: 0 !important; } /* layout -------------------------------------------------------------- */ .separate-containers .site-main { margin-top: 0 !important; } .post-template-single-package-child.separate-containers .site-main { margin-top: 3.05555vw !important; } @media only screen and (max-width: 1024px) { .site-header { width: 100% !important; display: block !important; float: none !important; height: inherit !important; } .main-navigation ul { border: 0 !important; line-height: 1em !important; } .main-navigation .main-nav ul li a { padding-left: 10px !important; padding-right: 10px !important; line-height: 1em !important; } .inside-header { display: block !important; vertical-align: inherit !important; padding: 3.75vw 0 0 0 !important; } .site-logo { display: inline-block; } .nav-aligned-center .main-navigation { text-align: center; } .main-navigation { width: 100% !important; display: inline-block !important; position: relative !important; float: none !important; clear: inherit !important; height: inherit !important; } .inside-navigation { display: inline-block !important; vertical-align: inherit !important; padding-right: 0 !important; text-align: center !important; margin: 0 auto !important; margin-top: 3.75vw !important; } } @media only screen and (max-width: 768px) { .site-header { width: 100% !important; display: table !important; float: left !important; height: 90px; } .main-navigation, .inside-navigation { display: none !important; } } </style> <style></style></link></meta></link></link></meta></head> <body class="post-template-default single single-post postid-11772 single-format-standard wp-custom-logo wp-embed-responsive no-sidebar nav-below-header separate-containers fluid-header active-footer-widgets-3 nav-aligned-center header-aligned-center dropdown-hover" itemscope="" itemtype="https://schema.org/Blog"> <div class="grid-toggle-wrap"><a class="grid-toggle">.</a></div> <div class="grid-guide"> <div class="grid-guide-col"><span>1</span></div> <div class="grid-guide-col"><span>2</span></div> <div class="grid-guide-col"><span>3</span></div> <div class="grid-guide-col"><span>4</span></div> <div class="grid-guide-col"><span>5</span></div> <div class="grid-guide-col"><span>6</span></div> <div class="grid-guide-col"><span>7</span></div> <div class="grid-guide-col"><span>8</span></div> <div class="grid-guide-col"><span>9</span></div> <div class="grid-guide-col"><span>10</span></div> <div class="grid-guide-col"><span>11</span></div> <div class="grid-guide-col"><span>12</span></div> <div class="grid-guide-col"><span>13</span></div> <div class="grid-guide-col"><span>14</span></div> <div class="grid-guide-col"><span>15</span></div> <div class="grid-guide-col"><span>16</span></div> <div class="grid-guide-col"><span>17</span></div> <div class="grid-guide-col"><span>18</span></div> <div class="grid-guide-col"><span>19</span></div> <div class="grid-guide-col"><span>20</span></div> <div class="grid-guide-col"><span>21</span></div> <div class="grid-guide-col"><span>22</span></div> <div class="grid-guide-col"><span>23</span></div> <div class="grid-guide-col"><span>24</span></div> </div> <div class="ad-space ad-space-leader top-ad-space hide-on-mobile"> <!-- GPT AdSlot 1 for Ad unit 'trb.chicagomag/hp' ### Size: [[728,90]] --> <div id="div-gpt-ad-2789321-1"> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-2789321-1'); }); </script> </div> <!-- End AdSlot 1 --> </div> <div class="ad-space ad-space-leader top-ad-space hide-on-desktop hide-on-tablet"> <!-- GPT AdSlot 6 for Ad unit 'trb.chicagomag/hp' ### Size: [[320,50]] --> <div id="div-gpt-ad-2789321-6"> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-2789321-6'); }); </script> </div> <!-- End AdSlot 6 --> </div> <div id="nav2-open"> <a class="nav2-toggle"><i class="fa fa-bars"></i></a> </div> <div id="nav2-close"> <a class="nav2-toggle"><i class="fa fa-times"></i></a> </div> <div id="nav2-overlay"></div> <div id="nav2-overlay-top"></div> <div id="nav2-overlay-btm"></div> <div id="nav2-inner-overlay"> <div id="nav2-inner"> <div class="grid-container grid-parent"> <div class="grid-5 prefix-1 suffix-1 nav2-cover hide-on-mobile"> <img src="/wp-content/uploads/2020/12/logo-alt.jpg"/> <img src=""/> <a href="https://cma.pcdfusion.com/pcd/Order?iKey=I**D7B" target="_blank">Subscribe</a> <a href="">Newsletters</a> <a class="nav-social" href="https://www.facebook.com/ChicagoMagazine" target="_blank"><i class="fab fa-facebook-f"></i></a> <a class="nav-social" href="http://www.twitter.com/chicagomag/" target="_blank"><i class="fab fa-twitter"></i></a> <a class="nav-social" href="http://instagram.com/chicagomag" target="_blank"><i class="fab fa-instagram"></i></a> <a class="nav-social" href="https://www.youtube.com/channel/UCOkRC6Y4LUyvglGmyC52KPw" target="_blank"><i class="fab fa-youtube"></i></a> </div> <div class="grid-100 nav2-cover hide-on-desktop"> <img src="/wp-content/uploads/2020/12/logo-alt.jpg"/> <form action="https://www.chicagomag.com/" class="search-form" method="get"> <label> <span class="screen-reader-text">Search for:</span> <input class="search-field" name="s" placeholder="Search …" title="Search for:" type="search" value=""/> </label> <input class="search-submit" type="submit" value="Search"/></form> </div> <div class="grid-7 prefix-1 suffix-1 mobile-grid-100 mobile-prefix-0 mobile-suffix-0"> <div class="section-header"> <div class="section-divide"></div> <h2>Sections</h2> </div> <a href="https://www.chicagomag.com/news/">News & Politics</a> <a href="https://www.chicagomag.com/dining-drinking/">Dining & Drinking</a> <a href="https://www.chicagomag.com/city-life/">City Life</a> <a href="https://www.chicagomag.com/arts-culture/">Culture</a> <a href="https://www.chicagomag.com/real-estate/">Real Estate</a> <a href="https://www.chicagomag.com/style-shopping/">Style</a> <div class="section-header"> <div class="section-divide"></div> <h2>Featured</h2> </div> <a href="https://www.chicagomag.com/video/">Video</a> <a href="https://www.chicagomag.com/long-reads/">Long Reads</a> <a href="https://www.chicagomag.com/chicago-magazine/april-2020/best-new-restaurants-11/">Best New Restaurants</a> <a href="https://www.chicagomag.com/top-doctors/">Top Doctors</a> </div> <div class="grid-7 suffix-1 mobile-grid-100 mobile-suffix-1"> <div class="section-header"> <div class="section-divide"></div> <h2>Magazine</h2> </div> <a href="https://www.chicagomag.com/issue-archive/">All Issues</a> <a href="https://cma.pcdfusion.com/pcd/Order?iKey=I**D7B">Subscribe</a> <a href="https://cma.pcdfusion.com/pcd/CustomerSupport/Account/Login?ReturnUrl=%2fpcd%2fCustomerSupport%2fApp%2f3141">Manage Subscription</a> <a href="https://www.chicagomag.com/advertise/">Advertise</a> <div class="section-header"> <div class="section-divide"></div> <h2>More</h2> </div> <a href="https://www.chicagomag.com/events/">Events</a> <a href="https://www.chicagomag.com/about-the-magazine/">About Us</a> <a href="https://www.chicagomag.com/contact-us/">Contact Us</a> <a href="https://www.chicagomag.com/follow-us/">Follow Us</a> <a href="https://www.chicagomag.com/resource-guide/">Resource Guide</a> </div> <div class="mobile-grid-100 hide-on-desktop" style="margin-bottom: 10vw;"> <img src="/wp-content/archive/Chicago-Magazine/December-2020/CMAG1220.jpg" style="margin-top: 5vw;"/> <a href="https://cma.pcdfusion.com/pcd/Order?iKey=I**D7B">Subscribe</a> <a href="">Newsletters</a> <a class="nav-social" href="https://www.facebook.com/ChicagoMagazine" target="_blank"><i class="fab fa-facebook-f"></i></a> <a class="nav-social" href="http://www.twitter.com/chicagomag/" target="_blank"><i class="fab fa-twitter"></i></a> <a class="nav-social" href="http://instagram.com/chicagomag" target="_blank"><i class="fab fa-instagram"></i></a> <a class="nav-social" href="https://www.youtube.com/channel/UCOkRC6Y4LUyvglGmyC52KPw" target="_blank"><i class="fab fa-youtube"></i></a> </div> </div> </div> </div> <div id="top-right-nav"> <div id="search-overlay"> <div id="search-close"> <a class="search-close-btn"> <i class="fas fa-times"></i> </a> </div> <form action="https://www.chicagomag.com/" class="search-form" method="get"> <label> <span class="screen-reader-text">Search for:</span> <input class="search-field" name="s" placeholder="Search …" title="Search for:" type="search" value=""/> </label> <input class="search-submit" type="submit" value="Search"/></form> </div> <div class="top-right-nav-links"> <a class="search-open"><i class="fa fa-search"></i></a> <a href="/events/">Events</a> <a href="https://cma.pcdfusion.com/pcd/Order?iKey=I**D7B">Subscribe</a> </div> </div> <div id="navbar"> <div id="nav2-open"> <a class="nav2-toggle"><i class="fa fa-bars"></i></a> </div> <a href="/"><img class="navbar-logo" src="/wp-content/uploads/2020/10/logo.png"/></a> </div> <a class="screen-reader-text skip-link" href="#content" title="Skip to content">Skip to content</a> <header class="site-header" id="masthead" itemscope="" itemtype="https://schema.org/WPHeader"> <div class="inside-header grid-container grid-parent"> <div class="site-logo"> <a href="https://www.chicagomag.com/" rel="home" title="Chicago Magazine"> <img alt="Chicago Magazine" class="header-image is-logo-image" src="https://www.chicagomag.com/wp-content/uploads/2020/10/logo.png" title="Chicago Magazine"> </img></a> </div> </div> </header> <nav class="main-navigation sub-menu-right" id="site-navigation" itemscope="" itemtype="https://schema.org/SiteNavigationElement"> <div class="inside-navigation grid-container grid-parent"> <button aria-controls="primary-menu" aria-expanded="false" class="menu-toggle"> <span class="mobile-menu">Menu</span> </button> <div class="main-nav" id="primary-menu"><ul class="menu sf-menu" id="menu-main"><li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-32855" id="menu-item-32855"><a href="https://www.chicagomag.com/news/">News & Politics</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-32856" id="menu-item-32856"><a href="https://www.chicagomag.com/dining-drinking/">Dining & Drinking</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-33687" id="menu-item-33687"><a href="https://www.chicagomag.com/city-life/">City Life</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-32857" id="menu-item-32857"><a href="https://www.chicagomag.com/arts-culture/">Culture</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-32858" id="menu-item-32858"><a href="https://www.chicagomag.com/real-estate/">Real Estate</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-32859" id="menu-item-32859"><a href="https://www.chicagomag.com/style-shopping/">Style</a></li> <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-29785" id="menu-item-29785"><a href="https://www.chicagomag.com/top-doctors/">Top Docs</a></li> </ul></div> </div> </nav> <div class="hfeed site grid-container container grid-parent" id="page"> <div class="site-content" id="content"> <div id="page-title"></div> <!-- start external content --> <!-- end external content --> <div class="content-area grid-parent mobile-grid-100 grid-100 tablet-grid-100" id="primary"> <main class="site-main" id="main"> <style> .article-wrap { margin-top: 2.22222vw !important; } .single .article-img { text-align: left; } @media only screen and (max-width: 1024px) { .container.grid-container { width: 100%; } .article-wrap .grid-10:first-of-type { display: none; } .article-side { padding-left: 0 !important; } .article-img { max-width: 100%; } } @media only screen and (max-width: 480px) { .site-header { width: 100% !important; height: 70px; } .main-navigation { display: none !important; } .article-body p, .article-body li { font-size: 18px; } .drop-cap { width: 70px; height: 70px; font-size: 60px; line-height: 70px; } .drop-cap-secondary { font-size: 60px; height: 45px; } } </style> <!-- start featured --> <!-- start super article featured image --> <!-- end super article featured image --> <!-- start head and deck --> <div class="grid-container grid-parent art-head-deck"> <div class="grid-12 prefix-5 tablet-grid-14 tablet-prefix-0 mobile-grid-100 mobile-prefix-0"> <div class="art-head h60">The 50 Best Sandwiches in Chicago</div> <div class="art-deck"><p>Our list of Chicago’s 50 best sandwiches, ranked in order of deliciousness</p> </div> <div class="art-byline-wrap"> </div> <div class="art-timestamp">October 9, 2012, 6:12 pm</div> <div class="heateor_sss_sharing_container heateor_sss_horizontal_sharing" heateor-sss-data-href="https://www.chicagomag.com/chicago-magazine/november-2012/best-sandwiches-chicago/" ss-offset="0"><ul class="heateor_sss_sharing_ul"><li class="heateorSssSharingRound"><i alt="Facebook" class="heateorSssSharing heateorSssFacebookBackground" onclick='heateorSssPopup("https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fwww.chicagomag.com%2Fchicago-magazine%2Fnovember-2012%2Fbest-sandwiches-chicago%2F")' style="width:24px;height:24px;border-radius:999px;" title="Facebook"><ss class="heateorSssSharingSvg heateorSssFacebookSvg" style="display:block;border-radius:999px;"></ss></i></li><li class="heateorSssSharingRound"><i alt="Twitter" class="heateorSssSharing heateorSssTwitterBackground" onclick='heateorSssPopup("http://twitter.com/intent/tweet?text=The%2050%20Best%20Sandwiches%20in%20Chicago&url=https%3A%2F%2Fwww.chicagomag.com%2Fchicago-magazine%2Fnovember-2012%2Fbest-sandwiches-chicago%2F")' style="width:24px;height:24px;border-radius:999px;" title="Twitter"><ss class="heateorSssSharingSvg heateorSssTwitterSvg" style="display:block;border-radius:999px;"></ss></i></li><li class="heateorSssSharingRound"><i alt="Email" class="heateorSssSharing heateorSssEmailBackground" onclick="window.open('mailto:?subject=' + decodeURIComponent('The%2050%20Best%20Sandwiches%20in%20Chicago' ).replace('&', '%26') + '&body=' + decodeURIComponent('https%3A%2F%2Fwww.chicagomag.com%2Fchicago-magazine%2Fnovember-2012%2Fbest-sandwiches-chicago%2F' ), '_blank')" style="width:24px;height:24px;border-radius:999px;" title="Email"><ss class="heateorSssSharingSvg heateorSssEmailSvg" style="display:block"></ss></i></li><li class="heateorSssSharingRound"><i alt="Copy Link" class="heateorSssSharing heateorSssCopyLinkBackground" style="width:24px;height:24px;border-radius:999px;" title="Copy Link"><ss class="heateorSssSharingSvg heateorSssCopyLinkSvg" style="display:block;border-radius:999px;"></ss></i></li><li class="heateorSssSharingRound"><i alt="Comment" class="heateorSssSharing heateorSssCommentBackground" style="width:24px;height:24px;border-radius:999px;" title="Comment"><a href="https://www.chicagomag.com/chicago-magazine/november-2012/best-sandwiches-chicago/#respond" rel="nofollow"><ss class="heateorSssSharingSvg heateorSssCommentSvg" style="display:block"></ss></a></i></li></ul><div class="heateorSssClear"></div></div> </div> </div> <!-- end head and deck --> <!-- start featured image below meta data --> <div class="grid-container grid-parent featured-img"> <div class="grid-12 prefix-5 tablet-grid-14 tablet-prefix-0 mobile-grid-100 mobile-prefix-0"> <div class="article-img"> <figure> <img src="/wp-content/archive/Chicago-Magazine/November-2012/Best-Sandwiches-Chicago/sandwich-old-oak.jpg"/> <figcaption>BLT at Old Oak Tap, the No. 1 sandwich in Chicago. <span class="photo-credit">Photograph: Anna Knott; Food Stylist: Lisa Kuehl</span></figcaption> </figure> </div> </div> </div> <!-- end featured image below meta data --> <!-- end featured --> <!-- start article wrap --> <div class="grid-container grid-parent article-wrap"> <div class="grid-4 hide-on-tablet hide-on-mobile"> </div> <div class="grid-12 prefix-1 tablet-grid-14 tablet-prefix-0 suffix-1 mobile-grid-100 mobile-prefix-0 mobile-suffix-0"> <div class="article-body"> <p><span class="dropcap">F</span>or generations, sandwiches were the ultimate guilty pleasure of subcultures that had no patience for guilt: hungry bachelors, school kids, working stiffs, old men in delis. To fridge-foraging rubes like Dagwood, quality wasn’t half as important as quantity. The sandwich was one of the only snacks you were allowed to pile as high as you wanted with anything you desired and cram into your face with both hands—a meal so inelegant and blithely proud of its inelegance that it came in six-foot segments for parties. And we ate it. Standing up.</p> <section class="related-content pull-right"> <h3>Related Content</h3> <ul> <li><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in- Chicago-The-Best-Sliders-in-Town">The Best Sliders in Town</a></li> <li><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in- Chicago-Where-to-Get-Your-Fix-Around-the-Clock">Where to Get Your Fix Around the Clock</a></li> </ul> </section> <p>Now we’ve got French dips made with shaved prime rib, po’ boys with organic shrimp, and grilled cheese with fancy pimiento cheese. Hell, you can get a buttered ciabatta layered with local eggs, house-cured speck, and fontina for breakfast at Balsan if the idea of spending $19 for a ham and egg sandwich does not scandalize you. What in the name of John Montagu is going on here?</p> <p>The sandwich pendulum has always swung erratically from the treat of the nobility to the fuel of the proletariat. But what we’re witnessing now is the sharpest swerve yet toward the land of fine dining—a shift that overlaps, not coincidentally, with the great democratization of Chicago’s restaurants. Ground zero for the boom is Publican Quality Meats, where Paul Kahan regards sandwiches as serious dishes. So does Acadia’s Ryan McCaskey, who makes a mean lobster roll, and Rick Bayless, who offers up a vegetarian stunner at Xoco.</p> <p>To guide you through the bustling sandscape, we fanned out across the city and suburbs, hitting spots high and low in search of anything delicious between two slices of bread. For the purposes of this story, we defined “sandwich” in the strictest of terms: no wraps, dumplings, or open-faced pretenders. Hamburgers and hot dogs didn’t qualify. Italian beef sandwiches did, but not one made this list. (Face facts: Chicago’s spongy grease bomb is not among the better contributions to the genre.) We gave points to the well crafted, the fresh, and the robust, anchored by bread with enough distinct character to bolster the proceedings without overshadowing or interfering.</p> <p>The result: our list of Chicago’s 50 best sandwiches, ranked in order of deliciousness. Some are ingenious, such as Scofflaw’s layered masterpiece of braised brisket, pork belly, and pork loin. Others are blunt and glorious classics, done simply and done right. (Meatball sub from Bari, take a bow.)</p> <p>In our research, we learned that the sandwich is a wily chameleon, soaking up and synthesizing every trend, be it the resurgence of house-cured charcuterie or the sudden ubiquity of arugula. We learned to ask for extra napkins ahead of time. And we learned, above all, that quality and quantity can intersect in restaurants, and there’s no shame in that. Only joy.</p> <div class="sammy" style="position: relative;"> <div class="sammyRank">1</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Old-Oak-Tap-BLT/"><b>BLT</b><br/> Old Oak Tap<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">2</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Au-Cheval-Fried-Bologna/"><b>Fried Bologna</b><br/> Au Cheval<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">3</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Xoco-Woodland-Mushroom/"><b>Woodland Mushroom</b><br/> Xoco<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">4</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Als-Deli-Roast-Beef/"><b>Roast Beef</b><br/> Al’s Deli<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">5</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Publican-Quality-Meats-PB-L/"><b>PB&L</b><br/> Publican Quality Meats<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">6</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Hendrickx-Belgian-Bread-Crafter-Belgian-Chicken-Curry-Salad/"><b>Belgian Chicken Curry Salad</b><br/> Hendrickx Belgian Bread Crafter<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">7</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Acadia-Lobster-Roll/"><b>Lobster Roll</b><br/> Acadia<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">8</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Birchwood-Kitchen-Smoked-Salmon-Salad/"><b>Smoked Salmon Salad</b><br/> Birchwood Kitchen<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">9</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Cemitas-Puebla-Atomica-Cemitas/"><b>Atomica Cemitas</b><br/> Cemitas Puebla<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">10</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Nana-Grilled-Laughing-Bird-Shrimp-and-Fried-Oyster-Po-Boy/"><b>Grilled Laughing Bird Shrimp and Fried Po’ Boy</b><br/> Nana<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">11</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Lula-Cafe-Ham-and-Raclette-Panino/"><b>Ham and Raclette Panino</b><br/> Lula Cafe<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">12</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Ricobenes-Breaded-Steak/"><b>Breaded Steak</b><br/> Ricobene’s<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">13</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Frog-n-Snail-The-Hawkeye/"><b>The Hawkeye</b><br/> Frog n Snail<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">14</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Crosbys-Kitchen-Chicken-Dip/"><b>Chicken Dip</b><br/> Crosby’s Kitchen<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">15</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Longman-and-Eagle-Wild-Boar-Sloppy-Joe/"><b>Wild Boar Sloppy Joe</b><br/> Longman & Eagle<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">16</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Bari-Meatball-Sub/"><b>Meatball Sub</b><br/> Bari<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">17</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Mannys-Corned-Beef/"><b>Corned Beef</b><br/> Manny’s<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">18</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Eggys-Turkey-Club/"><b>Turkey Club</b><br/> Eggy’s<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">19</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Old-Jerusalem-Falafel/"><b>Falafel</b><br/> Old Jerusalem<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">20</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Mindys-HotChocolate-Crab-Cake/"><b>Crab Cake</b><br/> Mindy’s HotChocolate<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">21</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Olgas-Delicatessen-Chicken-Schnitzel/"><b>Chicken Schnitzel</b><br/> Olga’s Delicatessen<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">22</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Dawali-Mediterranean-Kitchen-Shawarma/"><b>Shawarma</b><br/> Dawali Mediterranean Kitchen<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">23</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Big-Jones-Toasted-Pimiento-Cheese/"><b>Toasted Pimiento Cheese</b><br/> Big Jones<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">24</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-La-Pane-Vegetarian-Panino/"><b>Vegetarian Panino</b><br/> La Pane<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">25</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Pastoral-Cali-Chevre/"><b>Cali Chèvre</b><br/> Pastoral<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">26</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Maxs-Deli-Pastrami/"><b>Pastrami</b><br/> Max’s Deli<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">27</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Luckys-Sandwich-Co-The-Fredo/"><b>The Fredo</b><br/> Lucky’s Sandwich Co.<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">28</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-City-Provisions-Smoked-Ham/"><b>Smoked Ham</b><br/> City Provisions<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">29</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Papas-Cache-Sabroso-Jibarito/"><b>Jibarito</b><br/> Papa’s Cache Sabroso<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">30</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Bavettes-Bar-and-Boeuf-Shaved-Prime-Rib/"><b>Shaved Prime Rib</b><br/> Bavette’s Bar & Boeuf<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">31</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Hannahs-Bretzel-Serrano-Ham-and-Manchego-Cheese/"><b>Serrano Ham and Manchego Cheese</b><br/> Hannah’s Bretzel<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">32</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-La-Fournette-Tuna-Salad/"><b>Tuna Salad</b><br/> La Fournette<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">33</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Paramount-Room-Paramount-Reuben/"><b>Paramount Reuben</b><br/> Paramount Room<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">34</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Melt-Sandwich-Shoppe-The-Istanbul/"><b>The Istanbul</b><br/> Melt Sandwich Shoppe<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">35</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Floriole-Cafe-and-Bakery-BAD/"><b>B.A.D.</b><br/> Floriole Cafe & Bakery<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">36</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-First-Slice-Pie-Cafe-Duck-Confit-and-Mozzarella/"><b>Duck Confit and Mozzarella</b><br/> First Slice Pie Café<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">37</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Troquet-Croque-Monsieur/"><b>Croque Monsieur</b><br/> Troquet<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">38</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Grahamwich-Green-Garbanzo/"><b>Green Garbanzo</b><br/> Grahamwich<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">39</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Saigon-Sisters-The-Hen-House/"><b>The Hen House</b><br/> Saigon Sisters<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">40</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Rosalias-Deli-Tuscan-Chicken/"><b>Tuscan Chicken</b><br/> Rosalia’s Deli<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">41</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Z-and-H-MarketCafe-The-Marty/"><b>The Marty </b><br/> Z&H MarketCafe<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">42</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Market-House-on-the-Square-Whitefish/"><b>Whitefish</b><br/> Market House on the Square<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">43</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Elaines-Coffee-Call-Oat-Bread-Pecan-Butter-and-Fruit-Jam/"><b>Oat Bread, Pecan Butter, and Fruit Jam</b><br/> Elaine’s Coffee Call<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">44</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Marion-Street-Cheese-Market-Cauliflower-Melt/"><b>Cauliflower Melt</b><br/> Marion Street Cheese Market<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">45</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Cafecito-Cubano/"><b>Cubana</b><br/> Cafecito<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">46</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Chickpea-Kufta/"><b>Kufta</b><br/> Chickpea<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">47</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-The-Goddess-and-Grocer-Debbies-Egg-Salad/"><b>Debbie’s Egg Salad</b><br/> The Goddess and Grocer<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">48</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Zenwich-Beef-Curry/"><b>Beef Curry</b><br/> Zenwich<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative;"> <div class="sammyRank">49</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Toni-Patisserie-Le-Vegetarien/"><b>Le Végétarien</b><br/> Toni Patisserie<br/> <em>Read more</em> </a></div> </div> <div class="sammy" style="position: relative; border-bottom: 0"> <div class="sammyRank">50</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Phoebes-Bakery-The-Gatsby/"><b>The Gatsby</b><br/> Phoebe’s Bakery<br/> <em>Read more</em> </a></div> </div> <p><!-- /#sandwichFront --></p> <footer>Edited by Carly Boers, Penny Pollack, and Jeff Ruby; Contributors: Cassie Walker Burke, Elly Fishman, Peter Gianopulos, Noah Isackson, Maryanne Johnson, Esther Kang, Megan Lovejoy, Graham Meyer, Matt Schur, Lena Singer, Emmet Sullivan, Jennifer Tanaka, Joanne Trestrail</footer> </div> <div class="article-tags"> <p>Tags: <a href="https://www.chicagomag.com/tag/best-of-chicago/" rel="tag">Best of Chicago</a>, <a href="https://www.chicagomag.com/tag/dining-drinking/" rel="tag">Dining & Drinking</a>, <a href="https://www.chicagomag.com/tag/print-specific-tags-cover-story/" rel="tag">Print-Specific Tags - Cover Story</a></p> </div> </div> <div class="article-side grid-6 tablet-grid-9 mobile-grid-100 most-pop"> <div class="ad-space"> <!-- GPT AdSlot 12 for Ad unit 'trb.chicagomag/hp' ### Size: [[300,250],[300,600]] --> <div class="hide-on-mobile" id="div-gpt-ad-2789321-12"> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-2789321-12'); }); </script> </div> <!-- End AdSlot 12 --> <!-- GPT AdSlot 15 for Ad unit 'trb.chicagomag/hp' ### Size: [[300,250] --> <div class="hide-on-desktop hide-on-tablet" id="div-gpt-ad-2789321-15"> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-2789321-15'); }); </script> </div> <!-- End AdSlot 15 --> <!-- GPT AdSlot 11 for Ad unit 'trb.chicagomag/hp' ### Size: [[300,250]] --> <div id="div-gpt-ad-2789321-11"> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-2789321-11'); }); </script> </div> <!-- End AdSlot 11 --> </div> </div> </div> <!-- end article wrap --> <!-- start ad --> <div class="grid-container grid-parent ad-space ad-space-leader hide-on-mobile mb-0"> <!-- GPT AdSlot 5 for Ad unit 'trb.chicagomag/hp' ### Size: [[728,90]] --> <div id="div-gpt-ad-2789321-5"> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-2789321-5'); }); </script> </div> <!-- End AdSlot 5 --> </div> <div class="grid-container grid-parent ad-space ad-space-leader hide-on-desktop hide-on-tablet"> <!-- GPT AdSlot 10 for Ad unit 'trb.chicagomag/hp' ### Size: [[320,50]] --> <div id="div-gpt-ad-2789321-10"> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-2789321-10'); }); </script> </div> <!-- End AdSlot 10 --> </div> <!-- end ad --> <div class="comments-area grid-container grid-parent"> <div class="grid-12 prefix-5 mobile-grid-100 mobile-prefix-0"> <div id="comments"> <div class="comment-respond" id="respond"> <h3 class="comment-reply-title" id="reply-title">Leave a Comment <small><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-Chicago/#respond" id="cancel-comment-reply-link" rel="nofollow" style="display:none;">Cancel reply</a></small></h3><form action="https://www.chicagomag.com/wp-comments-post.php?wpe-comment-post=chicagomag" class="comment-form" id="commentform" method="post" novalidate=""><p class="comment-form-comment"><label class="screen-reader-text" for="comment">Comment</label><textarea aria-required="true" autocomplete="new-password" cols="45" id="c2cc66bfa4" name="c2cc66bfa4" required="" rows="8"></textarea><textarea aria-hidden="true" autocomplete="new-password" id="comment" name="comment" style="padding:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;position:absolute !important;white-space:nowrap !important;height:1px !important;width:1px !important;overflow:hidden !important;" tabindex="-1"></textarea><script data-noptimize="" type="text/javascript">document.getElementById("comment").setAttribute( "id", "aa6b3b1fdfa2d73112ccf24c2fa11145" );document.getElementById("c2cc66bfa4").setAttribute( "id", "comment" );</script></p><label class="screen-reader-text" for="author">Name</label><input id="author" name="author" placeholder="Name *" size="30" type="text" value=""> <label class="screen-reader-text" for="email">Email</label><input id="email" name="email" placeholder="Email *" size="30" type="email" value=""> <label class="screen-reader-text" for="url">Website</label><input id="url" name="url" placeholder="Website" size="30" type="url" value=""> <p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"> <label for="wp-comment-cookies-consent">Save my name, email, and website in this browser for the next time I comment.</label></input></p> <p class="form-submit"><input class="submit" id="submit" name="submit" type="submit" value="Post Comment"/> <input id="comment_post_ID" name="comment_post_ID" type="hidden" value="11772"/> <input id="comment_parent" name="comment_parent" type="hidden" value="0"/> </p></input></input></input></form> </div><!-- #respond --> </div><!-- #comments --> </div> </div> </main><!-- #main --> </div><!-- #primary --> </div><!-- #content --> </div><!-- #page --> <!-- start footer --> <div id="footer"> <div class="grid-container"> <div class="grid-5 suffix-1 mobile-grid-12 mobile-suffix-0 grid-parent-mobile left"> <div class="wrap"> <a href="https://cma.pcdfusion.com/pcd/Order?iKey=I**D7B">Subscribe</a> <a href="https://cma.pcdfusion.com/pcd/CustomerSupport/Account/Login?ReturnUrl=%2fpcd%2fCustomerSupport%2fApp%2f3141">Manage Subscription</a> <a href="https://www.chicagomag.com/issue-archive/">Issue Archive</a> <a href="http://www.tronc.com/privacy-policy/">Privacy Policy</a> <a href="http://www.tronc.com/central-terms-of-service/">Terms of Service</a> </div> </div> <div class="grid-10 prefix-1 suffix-1 mobile-grid-100 mobile-prefix-0 grid-parent-mobile middle hide-on-mobile"> <div class="wrap"> <h2>Follow Us</h2> <div class="footer-social"> <a href="https://www.facebook.com/ChicagoMagazine" target="_blank"><i class="fab fa-facebook-f"></i></a> <a href="http://www.twitter.com/chicagomag/" target="_blank"><i class="fab fa-twitter"></i></a> <a href="http://instagram.com/chicagomag" target="_blank"><i class="fab fa-instagram"></i></a> <a href="https://www.youtube.com/channel/UCOkRC6Y4LUyvglGmyC52KPw" target="_blank"><i class="fab fa-youtube"></i></a> </div> <h2>Get Our Newsletters</h2> <p>Subscribe to one or more of our free e-mail newsletters to get instant updates on local news, events, and opportunities in Chicago.</p> <div class="footer-form" style="display:flex; margin-top:60px;"> <table> <tr> <td><input type="text"/></td> <td><button style="background:#d2232a; color:#fff;">Sign Up</button></td> </tr> </table> </div> <div class="copyright">©2020 Chicago magazine / A Chicago Tribune Media Group website</div> </div> </div> <div class="grid-5 prefix-1 mobile-grid-12 mobile-prefix-0 mobile-suffix-0 grid-parent-mobile right"> <div class="wrap"> <a href="https://www.chicagomag.com/about-the-magazine/">About the Magazine</a> <a href="https://www.chicagomag.com/contact-us/">Contact Us</a> <a href="https://www.chicagomag.com/advertise/">Advertise</a> <a href="https://www.chicagomag.com/resource-guide/">Resource Guide</a> <a href="https://www.chicagomag.com/events/">Events</a> </div> </div> <div class="mobile-grid-100 mobile-prefix-0 mobile-suffix-1 grid-parent-mobile middle hide-on-desktop hide-on-tablet"> <div class="wrap"> <h2>Follow Us</h2> <div class="footer-social"> <a href="https://www.facebook.com/ChicagoMagazine" target="_blank"><i class="fab fa-facebook-f"></i></a> <a href="http://www.twitter.com/chicagomag/" target="_blank"><i class="fab fa-twitter"></i></a> <a href="http://instagram.com/chicagomag" target="_blank"><i class="fab fa-instagram"></i></a> <a href="https://www.youtube.com/channel/UCOkRC6Y4LUyvglGmyC52KPw" target="_blank"><i class="fab fa-youtube"></i></a> </div> <h2>Get Our Newsletters</h2> <p>Subscribe to one or more of our free e-mail newsletters to get instant updates on local news, events, and opportunities in Chicago.</p> <div class="footer-form" style="display:flex; margin-top:60px;"> <input style="width:80%;" type="text"/> <button style="width:20%; background:#d2232a; color:#fff;">Sign Up</button> </div> <div class="copyright">©2020 Chicago magazine / A Chicago Tribune Media Group website</div> </div> </div> </div> </div> <!-- end footer --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> jQuery(document).ready(function($) { $(".grid-toggle").click(function(){ $(".grid-guide").toggle(); }); $(".nav2-toggle").click(function(){ $("#nav2-overlay").toggle(); $("#nav2-overlay-top").toggle(); $("#nav2-overlay-btm").toggle(); $("#nav2-inner-overlay").toggle(); $("#nav2-inner").toggle(); $("#nav2-open").toggle(); $("#nav2-close").toggle(); }); $(".search-open").click(function(){ $('#search-overlay').fadeIn().css('display', 'inline-block'); $('.search-field').focus(); //$('#search-close').fadeIn().css('display', 'block'); }); $(".search-close-btn").click(function(){ $("#search-overlay").fadeOut().toggle(); $("#search-close").fadeOut().toggle(); }); }); </script> <script> jQuery(document).ready(function($) { $(".toggle-rock").click(function(){ $('.indie-rock').fadeOut().css('display', 'none'); $('.new-music').fadeOut().css('display', 'none'); $('.rock').fadeIn().css('display', 'block'); }); $(".toggle-indie-rock").click(function(){ $('.rock').fadeOut().css('display', 'none'); $('.new-music').fadeOut().css('display', 'none'); $('.indie-rock').fadeIn().css('display', 'block'); }); $(".toggle-new-music").click(function(){ $('.indie-rock').fadeOut().css('display', 'none'); $('.rock').fadeOut().css('display', 'none'); $('.new-music').fadeIn().css('display', 'block'); }); $(".toggle-all-genre").click(function(){ $('.indie-rock').fadeIn().css('display', 'block'); $('.rock').fadeIn().css('display', 'block'); $('.new-music').fadeIn().css('display', 'block'); }); }); </script> <div class="site-footer"> <footer class="site-info" itemscope="" itemtype="https://schema.org/WPFooter"> <div class="inside-site-info grid-container grid-parent"> <div class="copyright-bar"> <span class="copyright">© 2021 Chicago Magazine</span> • Built with <a href="https://generatepress.com" itemprop="url">GeneratePress</a> </div> </div> </footer> </div><!-- .site-footer --> <!--[if lte IE 11]> <script src='https://www.chicagomag.com/wp-content/themes/generatepress/assets/js/classList.min.js?ver=3.0.2' id='generate-classlist-js'></script> <![endif]--> <script id="generate-main-js-extra"> var generatepressMenu = {"toggleOpenedSubMenus":"1","openSubMenuLabel":"Open Sub-Menu","closeSubMenuLabel":"Close Sub-Menu"}; </script> <script id="generate-main-js" src="https://www.chicagomag.com/wp-content/themes/generatepress/assets/js/main.min.js?ver=3.0.2"></script> <script id="comment-reply-js" src="https://www.chicagomag.com/wp-includes/js/comment-reply.min.js?ver=5.6"></script> <script id="heateor_sss_sharing_js-js-before"> function heateorSssLoadEvent(e) {var t=window.onload;if (typeof window.onload!="function") {window.onload=e}else{window.onload=function() {t();e()}}}; var heateorSssSharingAjaxUrl = 'https://www.chicagomag.com/wp-admin/admin-ajax.php', heateorSssCloseIconPath = 'https://www.chicagomag.com/wp-content/plugins/sassy-social-share/public/../images/close.png', heateorSssPluginIconPath = 'https://www.chicagomag.com/wp-content/plugins/sassy-social-share/public/../images/logo.png', heateorSssHorizontalSharingCountEnable = 0, heateorSssVerticalSharingCountEnable = 0, heateorSssSharingOffset = -10; var heateorSssMobileStickySharingEnabled = 0;var heateorSssCopyLinkMessage = "Link copied.";var heateorSssUrlCountFetched = [], heateorSssSharesText = 'Shares', heateorSssShareText = 'Share';function heateorSssPopup(e) {window.open(e,"popUpWindow","height=400,width=600,left=400,top=100,resizable,scrollbars,toolbar=0,personalbar=0,menubar=no,location=no,directories=no,status")};var heateorSssWhatsappShareAPI = "web"; </script> <script id="heateor_sss_sharing_js-js" src="https://www.chicagomag.com/wp-content/plugins/sassy-social-share/public/js/sassy-social-share-public.js?ver=3.3.20"></script> <script id="__ytprefsfitvids__-js" src="https://www.chicagomag.com/wp-content/plugins/youtube-embed-plus-pro/scripts/fitvids.min.js?ver=13.4.2"></script> <script id="wp-embed-js" src="https://www.chicagomag.com/wp-includes/js/wp-embed.min.js?ver=5.6"></script> <script> // When the user scrolls down 20px from the top of the document, slide down the navbar window.onscroll = function() {scrollFunction()}; function scrollFunction() { if (document.body.scrollTop > 240 || document.documentElement.scrollTop > 240) { document.getElementById("navbar").style.top = "0"; } else { document.getElementById("navbar").style.top = "-45px"; } } </script> </body> </html>
위 코드를 입력하면 전체 html 코드를 다 받게 된다.
print(soup.find_all('div', 'sammy'))
[<div class="sammy" style="position: relative;"> <div class="sammyRank">1</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Old-Oak-Tap-BLT/"><b>BLT</b><br/> Old Oak Tap<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">2</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Au-Cheval-Fried-Bologna/"><b>Fried Bologna</b><br/> Au Cheval<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">3</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Xoco-Woodland-Mushroom/"><b>Woodland Mushroom</b><br/> Xoco<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">4</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Als-Deli-Roast-Beef/"><b>Roast Beef</b><br/> Al’s Deli<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">5</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Publican-Quality-Meats-PB-L/"><b>PB&L</b><br/> Publican Quality Meats<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">6</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Hendrickx-Belgian-Bread-Crafter-Belgian-Chicken-Curry-Salad/"><b>Belgian Chicken Curry Salad</b><br/> Hendrickx Belgian Bread Crafter<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">7</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Acadia-Lobster-Roll/"><b>Lobster Roll</b><br/> Acadia<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">8</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Birchwood-Kitchen-Smoked-Salmon-Salad/"><b>Smoked Salmon Salad</b><br/> Birchwood Kitchen<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">9</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Cemitas-Puebla-Atomica-Cemitas/"><b>Atomica Cemitas</b><br/> Cemitas Puebla<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">10</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Nana-Grilled-Laughing-Bird-Shrimp-and-Fried-Oyster-Po-Boy/"><b>Grilled Laughing Bird Shrimp and Fried Po’ Boy</b><br/> Nana<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">11</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Lula-Cafe-Ham-and-Raclette-Panino/"><b>Ham and Raclette Panino</b><br/> Lula Cafe<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">12</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Ricobenes-Breaded-Steak/"><b>Breaded Steak</b><br/> Ricobene’s<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">13</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Frog-n-Snail-The-Hawkeye/"><b>The Hawkeye</b><br/> Frog n Snail<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">14</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Crosbys-Kitchen-Chicken-Dip/"><b>Chicken Dip</b><br/> Crosby’s Kitchen<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">15</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Longman-and-Eagle-Wild-Boar-Sloppy-Joe/"><b>Wild Boar Sloppy Joe</b><br/> Longman & Eagle<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">16</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Bari-Meatball-Sub/"><b>Meatball Sub</b><br/> Bari<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">17</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Mannys-Corned-Beef/"><b>Corned Beef</b><br/> Manny’s<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">18</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Eggys-Turkey-Club/"><b>Turkey Club</b><br/> Eggy’s<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">19</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Old-Jerusalem-Falafel/"><b>Falafel</b><br/> Old Jerusalem<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">20</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Mindys-HotChocolate-Crab-Cake/"><b>Crab Cake</b><br/> Mindy’s HotChocolate<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">21</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Olgas-Delicatessen-Chicken-Schnitzel/"><b>Chicken Schnitzel</b><br/> Olga’s Delicatessen<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">22</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Dawali-Mediterranean-Kitchen-Shawarma/"><b>Shawarma</b><br/> Dawali Mediterranean Kitchen<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">23</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Big-Jones-Toasted-Pimiento-Cheese/"><b>Toasted Pimiento Cheese</b><br/> Big Jones<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">24</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-La-Pane-Vegetarian-Panino/"><b>Vegetarian Panino</b><br/> La Pane<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">25</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Pastoral-Cali-Chevre/"><b>Cali Chèvre</b><br/> Pastoral<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">26</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Maxs-Deli-Pastrami/"><b>Pastrami</b><br/> Max’s Deli<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">27</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Luckys-Sandwich-Co-The-Fredo/"><b>The Fredo</b><br/> Lucky’s Sandwich Co.<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">28</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-City-Provisions-Smoked-Ham/"><b>Smoked Ham</b><br/> City Provisions<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">29</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Papas-Cache-Sabroso-Jibarito/"><b>Jibarito</b><br/> Papa’s Cache Sabroso<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">30</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Bavettes-Bar-and-Boeuf-Shaved-Prime-Rib/"><b>Shaved Prime Rib</b><br/> Bavette’s Bar & Boeuf<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">31</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Hannahs-Bretzel-Serrano-Ham-and-Manchego-Cheese/"><b>Serrano Ham and Manchego Cheese</b><br/> Hannah’s Bretzel<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">32</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-La-Fournette-Tuna-Salad/"><b>Tuna Salad</b><br/> La Fournette<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">33</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Paramount-Room-Paramount-Reuben/"><b>Paramount Reuben</b><br/> Paramount Room<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">34</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Melt-Sandwich-Shoppe-The-Istanbul/"><b>The Istanbul</b><br/> Melt Sandwich Shoppe<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">35</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Floriole-Cafe-and-Bakery-BAD/"><b>B.A.D.</b><br/> Floriole Cafe & Bakery<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">36</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-First-Slice-Pie-Cafe-Duck-Confit-and-Mozzarella/"><b>Duck Confit and Mozzarella</b><br/> First Slice Pie Café<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">37</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Troquet-Croque-Monsieur/"><b>Croque Monsieur</b><br/> Troquet<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">38</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Grahamwich-Green-Garbanzo/"><b>Green Garbanzo</b><br/> Grahamwich<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">39</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Saigon-Sisters-The-Hen-House/"><b>The Hen House</b><br/> Saigon Sisters<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">40</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Rosalias-Deli-Tuscan-Chicken/"><b>Tuscan Chicken</b><br/> Rosalia’s Deli<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">41</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Z-and-H-MarketCafe-The-Marty/"><b>The Marty </b><br/> Z&H MarketCafe<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">42</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Market-House-on-the-Square-Whitefish/"><b>Whitefish</b><br/> Market House on the Square<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">43</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Elaines-Coffee-Call-Oat-Bread-Pecan-Butter-and-Fruit-Jam/"><b>Oat Bread, Pecan Butter, and Fruit Jam</b><br/> Elaine’s Coffee Call<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">44</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Marion-Street-Cheese-Market-Cauliflower-Melt/"><b>Cauliflower Melt</b><br/> Marion Street Cheese Market<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">45</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Cafecito-Cubano/"><b>Cubana</b><br/> Cafecito<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">46</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Chickpea-Kufta/"><b>Kufta</b><br/> Chickpea<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">47</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-The-Goddess-and-Grocer-Debbies-Egg-Salad/"><b>Debbie’s Egg Salad</b><br/> The Goddess and Grocer<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">48</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Zenwich-Beef-Curry/"><b>Beef Curry</b><br/> Zenwich<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative;"> <div class="sammyRank">49</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Toni-Patisserie-Le-Vegetarien/"><b>Le Végétarien</b><br/> Toni Patisserie<br/> <em>Read more</em> </a></div> </div>, <div class="sammy" style="position: relative; border-bottom: 0"> <div class="sammyRank">50</div> <div class="sammyListing"><a href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Phoebes-Bakery-The-Gatsby/"><b>The Gatsby</b><br/> Phoebe’s Bakery<br/> <em>Read more</em> </a></div> </div>]
find_all 명령을 이용해서 div의 sammy 태그를 찾아 보았다. 더 확실히 하기 위해 len 명령으로 길이를 확인해 보면 50 이라고 나타난다.
len(soup.find_all('div','sammy'))
50
애초 시카고 매거진의 기사 제목에 있지만 맛집 50개 이므로 저 길이가 50이라면 일단 정확하게 찾은 것 같다.
print(soup.find_all('div','sammy')[0])
<div class="sammy" style="position: relative;"> <div class="sammyRank">1</div> <div class="sammyListing"><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Old-Oak-Tap-BLT/"><b>BLT</b><br/> Old Oak Tap<br/> <em>Read more</em> </a></div> </div>
그중 첫 번째 것만 확인해보면 원하던 정보가 다 있는걸로 보인다.
3-4 접근한 웹 페이지에서 원하는 데이터 추출하고 정리하기¶
그럼 이제 div의 sammy 태그에서 우리가 원하는 정보를 얻는 과정일 보자.
tmp_one = soup.find_all('div','sammy')[0]
type(tmp_one)
bs4.element.Tag
find_all로 찾은 결과는 bs4.element.Tag 라고 하는 형태로 이런 경우 그 변수에 다시 태그로 찾는 find,find_all 명령을 사용할 수 있다.
tmp_one.find(class_='sammyRank')
<div class="sammyRank">1</div>
그래서 find 명령을 한 번 더 사용하고 sammyRank를 찾아보면 나타난다. 여기선 text만 취하면 된다.
tmp_one.find(class_='sammyRank').get_text()
'1'
get_text() 명령을 사용하면 된다. 그러면 랭킹을 얻을 수 있다.
tmp_one.find(class_='sammyListing').get_text()
'BLT\nOld Oak Tap\nRead more '
이제 sammyListing을 얻으면 메뉴 이름과 가게 이름이 비록 같이 나오긴 했지만 얻게 되었다.
tmp_one.find('a')['href']
'/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Old-Oak-Tap-BLT/'
또 a 택에서 href 정보를 가지고 클릭했을 때 연결될 주소도 저장할 수 있다. 위로 두 번째 경우는 메뉴 이름과 가게 이름이 같이 있어서 분리해야 한다. 저 구조에서 쉽게 접근해 볼 수 있는 것 중 하나가 정규식이다.
import re
tmp_string = tmp_one.find(class_='sammyListing').get_text()
re.split(('\n|\r\n'), tmp_string)
print(re.split(('\n|\r\n'), tmp_string)[0])
print(re.split(('\n|\r\n'), tmp_string)[1])
BLT Old Oak Tap
당연히 정규식을 쓰기 위해 import re를 수행한다. 그리고 re에서 사용할 명령은 딱 하나 split이다. 말 그대로 내가 지정한 특정 패턴이 일치하면 분리시킨다. 나는 \n 이거나, \r\n이면 분리 시키고 싶다. 그래서 위처럼 re.split이라고 명령했다. 그러면 결과가 두 개가 되는데 첫 번째는 메뉴이름 두 번째는 가게 이름으로 하면 된다. '/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Old-Oak-Tap-BLT/' 이 결과가 다른 49개에 적용했을 때 항상 동일하지는 않다. 어떤 경우는 상대 경로로, 또 어떤 경우는 절대경로로 나오기 때문이다. 이럴 때 사용하는 것이 urllib에 있는 urljoin이라는 명령이다.
from urllib.parse import urljoin
rank = []
main_menu = []
cafe_name = []
url_add = []
list_soup = soup.find_all('div', 'sammy')
for item in list_soup:
rank.append(item.find(class_='sammyRank').get_text())
tmp_string = item.find(class_='sammyListing').get_text()
main_menu.append(re.split(('\n|\r\n'), tmp_string)[0])
cafe_name.append(re.split(('\n|\r\n'), tmp_string)[1])
url_add.append(urljoin(url, item.find('a')['href']))
위 코드는 먼저 랭크 순위, 메인메뉴, 카페 이름, 각각의 접근 주소를 저장할 빈 리스트를 두었다. 그리고 find_all 로 찾은 50개 정보를 가지고 반복문을 돌리면서 방금 했던 내용인 각각의 정보를 .append 명령으로 빈 리스트에 하나씩 추가하도록 했다. 이 코드를 다 수행하면,
rank[:5]
['1', '2', '3', '4', '5']
main_menu[:5]
['BLT', 'Fried Bologna', 'Woodland Mushroom', 'Roast Beef', 'PB&L']
cafe_name[:5]
['Old Oak Tap', 'Au Cheval', 'Xoco', 'Al’s Deli', 'Publican Quality Meats']
url_add[:5]
['http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Old-Oak-Tap-BLT/', 'http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Au-Cheval-Fried-Bologna/', 'http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Xoco-Woodland-Mushroom/', 'http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Als-Deli-Roast-Beef/', 'http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Publican-Quality-Meats-PB-L/']
len(rank), len(main_menu), len(cafe_name), len(url_add)
(50, 50, 50, 50)
이제 이 데이터를 4개의 리스트에 저장할 수는 없으니 pandas를 이용해보자.
import pandas as pd
data = {'Rank':rank,'Menu':main_menu,'Cafe':cafe_name,'URL':url_add}
df = pd.DataFrame(data)
df.head()
Rank | Menu | Cafe | URL | |
---|---|---|---|---|
0 | 1 | BLT | Old Oak Tap | http://www.chicagomag.com/Chicago-Magazine/Nov... |
1 | 2 | Fried Bologna | Au Cheval | http://www.chicagomag.com/Chicago-Magazine/Nov... |
2 | 3 | Woodland Mushroom | Xoco | http://www.chicagomag.com/Chicago-Magazine/Nov... |
3 | 4 | Roast Beef | Al’s Deli | http://www.chicagomag.com/Chicago-Magazine/Nov... |
4 | 5 | PB&L | Publican Quality Meats | http://www.chicagomag.com/Chicago-Magazine/Nov... |
위처럼 각 컬럼의 이름을 정의하고 해당 자료를 알려주면 된다.
df = pd.DataFrame(data, columns=['Rank', 'Cafe', 'Menu', 'URL'])
df.head()
Rank | Cafe | Menu | URL | |
---|---|---|---|---|
0 | 1 | Old Oak Tap | BLT | http://www.chicagomag.com/Chicago-Magazine/Nov... |
1 | 2 | Au Cheval | Fried Bologna | http://www.chicagomag.com/Chicago-Magazine/Nov... |
2 | 3 | Xoco | Woodland Mushroom | http://www.chicagomag.com/Chicago-Magazine/Nov... |
3 | 4 | Al’s Deli | Roast Beef | http://www.chicagomag.com/Chicago-Magazine/Nov... |
4 | 5 | Publican Quality Meats | PB&L | http://www.chicagomag.com/Chicago-Magazine/Nov... |
이렇게 결과가 나타난다. 이렇게 일차적으로 한 페이지에서 각 원하는 부분의 데이터를 읽어와서 다시 원하는 형태로 정리를 완료했다. 여기서 한단계 더 나아가자.
3-4 다수의 웹 페이지에 자동으로 접근해서 원하는 정보 가져오기¶
from bs4 import BeautifulSoup
from urllib.request import urlopen
import pandas as pd
df = pd.read_csv('/home/jaeyoon89//DataScience/data/03. best_sandwiches_list_chicago.csv', index_col=0)
df.head()
Rank | Cafe | Menu | URL | |
---|---|---|---|---|
0 | 1 | Old Oak Tap | BLT | http://www.chicagomag.com/Chicago-Magazine/Nov... |
1 | 2 | Au Cheval | Fried Bologna | http://www.chicagomag.com/Chicago-Magazine/Nov... |
2 | 3 | Xoco | Woodland Mushroom | http://www.chicagomag.com/Chicago-Magazine/Nov... |
3 | 4 | Al’s Deli | Roast Beef | http://www.chicagomag.com/Chicago-Magazine/Nov... |
4 | 5 | Publican Quality Meats | PB&L | http://www.chicagomag.com/Chicago-Magazine/Nov... |
이전에 작업했던 것을 읽어오자. 위 표에서 URL 컬럼에 있는 내용을 50개 읽어서 각 페이지에서 가게 주소, 대표 샌드위치 가격, 가게 전화번호를 얻는 것이다.
df['URL'][0]
'http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Old-Oak-Tap-BLT/'
첫번째 URL이 있다. 시카고 매거진의 또 다른 페이지이다. 이 주소를 BeautifulSoup로 읽는다.
import requests
from bs4 import BeautifulSoup
from urllib.request import urlopen
headers = {'User-Agent': 'Mozilla/5.0'}
html = (df['URL'][0])
res = requests.get(url, headers=headers)
soup_tmp = BeautifulSoup(res.text)
soup_tmp
<!DOCTYPE html> <html lang="en-US"> <head> <meta charset="utf-8"/> <meta content="IE=edge" http-equiv="X-UA-Compatible"> <link href="https://gmpg.org/xfn/11" rel="profile"/> <title>1. Old Oak Tap BLT – Chicago Magazine</title> <style type="text/css"> .heateorSssInstagramBackground{background:radial-gradient(circle at 30% 107%,#fdf497 0,#fdf497 5%,#fd5949 45%,#d6249f 60%,#285aeb 90%)} div.heateor_sss_horizontal_sharing i.heateorSssInstagramBackground{background:#000!important;}div.heateor_sss_standard_follow_icons_container i.heateorSssInstagramBackground{background:#000;} .heateor_sss_horizontal_sharing .heateorSssSharing,.heateor_sss_standard_follow_icons_container .heateorSssSharing{ background-color: #000; color: #fff; border-width: 0px; border-style: solid; border-color: transparent; } .heateor_sss_horizontal_sharing .heateorSssTCBackground{ color:#666; } .heateor_sss_horizontal_sharing .heateorSssSharing:hover,.heateor_sss_standard_follow_icons_container .heateorSssSharing:hover{ border-color: transparent; } .heateor_sss_vertical_sharing .heateorSssSharing,.heateor_sss_floating_follow_icons_container .heateorSssSharing{ color: #fff; border-width: 0px; border-style: solid; border-color: transparent; } .heateor_sss_vertical_sharing .heateorSssTCBackground{ color:#666; } .heateor_sss_vertical_sharing .heateorSssSharing:hover,.heateor_sss_floating_follow_icons_container .heateorSssSharing:hover{ border-color: transparent; } @media screen and (max-width:783px) {.heateor_sss_vertical_sharing{display:none!important}}@media screen and (max-width:783px) {.heateor_sss_floating_follow_icons_container{display:none!important}}</style><link href="//use.fontawesome.com" rel="dns-prefetch"> <link href="//s.w.org" rel="dns-prefetch"/> <link href="https://www.chicagomag.com/feed/" rel="alternate" title="Chicago Magazine » Feed" type="application/rss+xml"/> <link href="https://www.chicagomag.com/comments/feed/" rel="alternate" title="Chicago Magazine » Comments Feed" type="application/rss+xml"/> <link href="https://www.chicagomag.com/chicago-magazine/november-2012/best-sandwiches-in-chicago-old-oak-tap-blt/feed/" rel="alternate" title="Chicago Magazine » 1. Old Oak Tap BLT Comments Feed" type="application/rss+xml"/> <script> window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/13.0.1\/72x72\/","ext":".png","svgUrl":"https:\/\/s.w.org\/images\/core\/emoji\/13.0.1\/svg\/","svgExt":".svg","source":{"concatemoji":"https:\/\/www.chicagomag.com\/wp-includes\/js\/wp-emoji-release.min.js?ver=5.6"}}; !function(e,a,t){var r,n,o,i,p=a.createElement("canvas"),s=p.getContext&&p.getContext("2d");function c(e,t){var a=String.fromCharCode;s.clearRect(0,0,p.width,p.height),s.fillText(a.apply(this,e),0,0);var r=p.toDataURL();return s.clearRect(0,0,p.width,p.height),s.fillText(a.apply(this,t),0,0),r===p.toDataURL()}function l(e){if(!s||!s.fillText)return!1;switch(s.textBaseline="top",s.font="600 32px Arial",e){case"flag":return!c([127987,65039,8205,9895,65039],[127987,65039,8203,9895,65039])&&(!c([55356,56826,55356,56819],[55356,56826,8203,55356,56819])&&!c([55356,57332,56128,56423,56128,56418,56128,56421,56128,56430,56128,56423,56128,56447],[55356,57332,8203,56128,56423,8203,56128,56418,8203,56128,56421,8203,56128,56430,8203,56128,56423,8203,56128,56447]));case"emoji":return!c([55357,56424,8205,55356,57212],[55357,56424,8203,55356,57212])}return!1}function d(e){var t=a.createElement("script");t.src=e,t.defer=t.type="text/javascript",a.getElementsByTagName("head")[0].appendChild(t)}for(i=Array("flag","emoji"),t.supports={everything:!0,everythingExceptFlag:!0},o=0;o<i.length;o++)t.supports[i[o]]=l(i[o]),t.supports.everything=t.supports.everything&&t.supports[i[o]],"flag"!==i[o]&&(t.supports.everythingExceptFlag=t.supports.everythingExceptFlag&&t.supports[i[o]]);t.supports.everythingExceptFlag=t.supports.everythingExceptFlag&&!t.supports.flag,t.DOMReady=!1,t.readyCallback=function(){t.DOMReady=!0},t.supports.everything||(n=function(){t.readyCallback()},a.addEventListener?(a.addEventListener("DOMContentLoaded",n,!1),e.addEventListener("load",n,!1)):(e.attachEvent("onload",n),a.attachEvent("onreadystatechange",function(){"complete"===a.readyState&&t.readyCallback()})),(r=t.source||{}).concatemoji?d(r.concatemoji):r.wpemoji&&r.twemoji&&(d(r.twemoji),d(r.wpemoji)))}(window,document,window._wpemojiSettings); </script> <style> img.wp-smiley, img.emoji { display: inline !important; border: none !important; box-shadow: none !important; height: 1em !important; width: 1em !important; margin: 0 .07em !important; vertical-align: -0.1em !important; background: none !important; padding: 0 !important; } </style> <link href="https://www.chicagomag.com/wp-includes/css/dist/block-library/style.min.css?ver=5.6" id="wp-block-library-css" media="all" rel="stylesheet"/> <link href="https://www.chicagomag.com/wp-content/plugins/wordpress-popular-posts/assets/css/wpp.css?ver=5.2.4" id="wordpress-popular-posts-css-css" media="all" rel="stylesheet"/> <link href="//use.fontawesome.com/releases/v5.13.0/css/all.css?ver=5.6" id="font-awesome-free-css" media="all" rel="stylesheet"/> <link href="https://www.chicagomag.com/wp-content/themes/generatepress/assets/css/unsemantic-grid.min.css?ver=3.0.2" id="generate-style-grid-css" media="all" rel="stylesheet"/> <link href="https://www.chicagomag.com/wp-content/themes/generatepress/assets/css/style.min.css?ver=3.0.2" id="generate-style-css" media="all" rel="stylesheet"/> <style id="generate-style-inline-css"> body{background-color:#efefef;color:#3a3a3a;}a{color:#1e73be;}a:hover, a:focus, a:active{color:#000000;}body .grid-container{max-width:1100px;}.wp-block-group__inner-container{max-width:1100px;margin-left:auto;margin-right:auto;}body, button, input, select, textarea{font-family:-apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";}body{line-height:1.5;}.entry-content > [class*="wp-block-"]:not(:last-child){margin-bottom:1.5em;}.main-title{font-size:45px;}.main-navigation .main-nav ul ul li a{font-size:14px;}.sidebar .widget, .footer-widgets .widget{font-size:17px;}h1{font-weight:300;font-size:40px;}h2{font-weight:300;font-size:30px;}h3{font-size:20px;}h4{font-size:inherit;}h5{font-size:inherit;}@media (max-width:768px){.main-title{font-size:30px;}h1{font-size:30px;}h2{font-size:25px;}}.top-bar{background-color:#636363;color:#ffffff;}.top-bar a{color:#ffffff;}.top-bar a:hover{color:#303030;}.site-header{background-color:#ffffff;color:#3a3a3a;}.site-header a{color:#3a3a3a;}.main-title a,.main-title a:hover{color:#222222;}.site-description{color:#757575;}.main-navigation,.main-navigation ul ul{background-color:#222222;}.main-navigation .main-nav ul li a,.menu-toggle, .main-navigation .menu-bar-items{color:#ffffff;}.main-navigation .main-nav ul li:hover > a,.main-navigation .main-nav ul li:focus > a, .main-navigation .main-nav ul li.sfHover > a, .main-navigation .menu-bar-item:hover > a, .main-navigation .menu-bar-item.sfHover > a{color:#ffffff;background-color:#3f3f3f;}button.menu-toggle:hover,button.menu-toggle:focus,.main-navigation .mobile-bar-items a,.main-navigation .mobile-bar-items a:hover,.main-navigation .mobile-bar-items a:focus{color:#ffffff;}.main-navigation .main-nav ul li[class*="current-menu-"] > a{color:#ffffff;background-color:#3f3f3f;}.main-navigation .main-nav ul li[class*="current-menu-"] > a:hover,.main-navigation .main-nav ul li[class*="current-menu-"].sfHover > a{color:#ffffff;background-color:#3f3f3f;}.navigation-search input[type="search"],.navigation-search input[type="search"]:active, .navigation-search input[type="search"]:focus, .main-navigation .main-nav ul li.search-item.active > a, .main-navigation .menu-bar-items .search-item.active > a{color:#ffffff;background-color:#3f3f3f;}.main-navigation ul ul{background-color:#3f3f3f;}.main-navigation .main-nav ul ul li a{color:#ffffff;}.main-navigation .main-nav ul ul li:hover > a,.main-navigation .main-nav ul ul li:focus > a,.main-navigation .main-nav ul ul li.sfHover > a{color:#ffffff;background-color:#4f4f4f;}.main-navigation .main-nav ul ul li[class*="current-menu-"] > a{color:#ffffff;background-color:#4f4f4f;}.main-navigation .main-nav ul ul li[class*="current-menu-"] > a:hover,.main-navigation .main-nav ul ul li[class*="current-menu-"].sfHover > a{color:#ffffff;background-color:#4f4f4f;}.separate-containers .inside-article, .separate-containers .comments-area, .separate-containers .page-header, .one-container .container, .separate-containers .paging-navigation, .inside-page-header{background-color:#ffffff;}.entry-meta{color:#595959;}.entry-meta a{color:#595959;}.entry-meta a:hover{color:#1e73be;}.sidebar .widget{background-color:#ffffff;}.sidebar .widget .widget-title{color:#000000;}.footer-widgets{background-color:#ffffff;}.footer-widgets .widget-title{color:#000000;}.site-info{color:#ffffff;background-color:#222222;}.site-info a{color:#ffffff;}.site-info a:hover{color:#606060;}.footer-bar .widget_nav_menu .current-menu-item a{color:#606060;}input[type="text"],input[type="email"],input[type="url"],input[type="password"],input[type="search"],input[type="tel"],input[type="number"],textarea,select{color:#666666;background-color:#fafafa;border-color:#cccccc;}input[type="text"]:focus,input[type="email"]:focus,input[type="url"]:focus,input[type="password"]:focus,input[type="search"]:focus,input[type="tel"]:focus,input[type="number"]:focus,textarea:focus,select:focus{color:#666666;background-color:#ffffff;border-color:#bfbfbf;}button,html input[type="button"],input[type="reset"],input[type="submit"],a.button,a.wp-block-button__link:not(.has-background){color:#ffffff;background-color:#666666;}button:hover,html input[type="button"]:hover,input[type="reset"]:hover,input[type="submit"]:hover,a.button:hover,button:focus,html input[type="button"]:focus,input[type="reset"]:focus,input[type="submit"]:focus,a.button:focus,a.wp-block-button__link:not(.has-background):active,a.wp-block-button__link:not(.has-background):focus,a.wp-block-button__link:not(.has-background):hover{color:#ffffff;background-color:#3f3f3f;}a.generate-back-to-top{background-color:rgba( 0,0,0,0.4 );color:#ffffff;}a.generate-back-to-top:hover,a.generate-back-to-top:focus{background-color:rgba( 0,0,0,0.6 );color:#ffffff;}@media (max-width:768px){.main-navigation .menu-bar-item:hover > a, .main-navigation .menu-bar-item.sfHover > a{background:none;color:#ffffff;}}.inside-top-bar{padding:10px;}.inside-header{padding:40px;}.entry-content .alignwide, body:not(.no-sidebar) .entry-content .alignfull{margin-left:-40px;width:calc(100% + 80px);max-width:calc(100% + 80px);}.rtl .menu-item-has-children .dropdown-menu-toggle{padding-left:20px;}.rtl .main-navigation .main-nav ul li.menu-item-has-children > a{padding-right:20px;}.site-info{padding:20px;}@media (max-width:768px){.separate-containers .inside-article, .separate-containers .comments-area, .separate-containers .page-header, .separate-containers .paging-navigation, .one-container .site-content, .inside-page-header, .wp-block-group__inner-container{padding:30px;}.site-info{padding-right:10px;padding-left:10px;}.entry-content .alignwide, body:not(.no-sidebar) .entry-content .alignfull{margin-left:-30px;width:calc(100% + 60px);max-width:calc(100% + 60px);}}.one-container .sidebar .widget{padding:0px;}@media (max-width:768px){.main-navigation .menu-toggle,.main-navigation .mobile-bar-items,.sidebar-nav-mobile:not(#sticky-placeholder){display:block;}.main-navigation ul,.gen-sidebar-nav{display:none;}[class*="nav-float-"] .site-header .inside-header > *{float:none;clear:both;}} </style> <link href="https://www.chicagomag.com/wp-content/themes/generatepress/assets/css/mobile.min.css?ver=3.0.2" id="generate-mobile-style-css" media="all" rel="stylesheet"/> <link href="https://www.chicagomag.com/wp-content/themes/generatepress/assets/css/components/font-icons.min.css?ver=3.0.2" id="generate-font-icons-css" media="all" rel="stylesheet"/> <link href="https://www.chicagomag.com/wp-content/themes/Chicago%20Magazine/style.css?ver=1617134281" id="generate-child-css" media="all" rel="stylesheet"/> <link href="https://www.chicagomag.com/wp-content/plugins/sassy-social-share/public/css/sassy-social-share-public.css?ver=3.3.20" id="heateor_sss_frontend_css-css" media="all" rel="stylesheet"/> <link href="https://www.chicagomag.com/wp-content/plugins/sassy-social-share/admin/css/sassy-social-share-svg.css?ver=3.3.20" id="heateor_sss_sharing_default_svg-css" media="all" rel="stylesheet"/> <link href="https://www.chicagomag.com/wp-content/plugins/youtube-embed-plus-pro/styles/ytprefs.min.css?ver=13.4.2" id="__EPYT__style-css" media="all" rel="stylesheet"/> <style id="__EPYT__style-inline-css"> .epyt-gallery-thumb { width: 33.333%; } @media (min-width:0px) and (max-width: 767px) { .epyt-gallery-rowbreak { display: none; } .epyt-gallery-allthumbs[class*="epyt-cols"] .epyt-gallery-thumb { width: 100% !important; } } </style> <link href="https://www.chicagomag.com/wp-content/plugins/youtube-embed-plus-pro/scripts/lity.min.css?ver=13.4.2" id="__disptype__-css" media="all" rel="stylesheet"/> <script id="wpp-json" type="application/json"> {"sampling_active":0,"sampling_rate":100,"ajax_url":"https:\/\/www.chicagomag.com\/wp-json\/wordpress-popular-posts\/v1\/popular-posts","ID":11773,"token":"6862fde4c7","lang":0,"debug":0} </script> <script id="wpp-js-js" src="https://www.chicagomag.com/wp-content/plugins/wordpress-popular-posts/assets/js/wpp.min.js?ver=5.2.4"></script> <script id="jquery-core-js" src="https://www.chicagomag.com/wp-includes/js/jquery/jquery.min.js?ver=3.5.1"></script> <script id="jquery-migrate-js" src="https://www.chicagomag.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=3.3.2"></script> <script id="__dispload__-js" src="https://www.chicagomag.com/wp-content/plugins/youtube-embed-plus-pro/scripts/lity.min.js?ver=13.4.2"></script> <script id="__ytprefs__-js-extra"> var _EPYT_ = {"ajaxurl":"https:\/\/www.chicagomag.com\/wp-admin\/admin-ajax.php","security":"c89bc8a921","gallery_scrolloffset":"20","eppathtoscripts":"https:\/\/www.chicagomag.com\/wp-content\/plugins\/youtube-embed-plus-pro\/scripts\/","eppath":"https:\/\/www.chicagomag.com\/wp-content\/plugins\/youtube-embed-plus-pro\/","epresponsiveselector":"[\"iframe.__youtube_prefs_widget__\"]","epdovol":"1","version":"13.4.2","evselector":"iframe.__youtube_prefs__[src], iframe[src*=\"youtube.com\/embed\/\"], iframe[src*=\"youtube-nocookie.com\/embed\/\"]","ajax_compat":"","ytapi_load":"light","pause_others":"","stopMobileBuffer":"1","vi_active":"","vi_js_posttypes":[]}; </script> <script id="__ytprefs__-js" src="https://www.chicagomag.com/wp-content/plugins/youtube-embed-plus-pro/scripts/ytprefs.min.js?ver=13.4.2"></script> <link href="https://www.chicagomag.com/wp-json/" rel="https://api.w.org/"/><link href="https://www.chicagomag.com/wp-json/wp/v2/posts/11773" rel="alternate" type="application/json"/><link href="https://www.chicagomag.com/xmlrpc.php?rsd" rel="EditURI" title="RSD" type="application/rsd+xml"/> <link href="https://www.chicagomag.com/wp-includes/wlwmanifest.xml" rel="wlwmanifest" type="application/wlwmanifest+xml"/> <link href="https://www.chicagomag.com/chicago-magazine/november-2012/best-sandwiches-in-chicago-old-oak-tap-blt/" rel="canonical"/> <link href="https://www.chicagomag.com/?p=11773" rel="shortlink"/> <link href="https://www.chicagomag.com/wp-json/oembed/1.0/embed?url=https%3A%2F%2Fwww.chicagomag.com%2Fchicago-magazine%2Fnovember-2012%2Fbest-sandwiches-in-chicago-old-oak-tap-blt%2F" rel="alternate" type="application/json+oembed"/> <link href="https://www.chicagomag.com/wp-json/oembed/1.0/embed?url=https%3A%2F%2Fwww.chicagomag.com%2Fchicago-magazine%2Fnovember-2012%2Fbest-sandwiches-in-chicago-old-oak-tap-blt%2F&format=xml" rel="alternate" type="text/xml+oembed"/> <link href="https://www.chicagomag.com/xmlrpc.php" rel="pingback"/> <meta content="width=device-width, initial-scale=1" name="viewport"/><link href="https://www.chicagomag.com/wp-content/uploads/2021/02/favicon.png" rel="icon" sizes="32x32"> <link href="https://www.chicagomag.com/wp-content/uploads/2021/02/favicon.png" rel="icon" sizes="192x192"/> <link href="https://www.chicagomag.com/wp-content/uploads/2021/02/favicon.png" rel="apple-touch-icon"/> <meta content="https://www.chicagomag.com/wp-content/uploads/2021/02/favicon.png" name="msapplication-TileImage"> <!-- BEGIN Typekit Fonts for WordPress --> <link href="https://use.typekit.net/ukb3erh.css" rel="stylesheet"/> <!-- END Typekit Fonts for WordPress --> <!-- start seo fields --> <meta content="" inspired.""="" name="description" truly=""/> <meta content="" name="keywords"/> <meta content="en_US" property="og:locale"/> <meta content="article" property="og:type"/> <meta content="1. Old Oak Tap BLT" property="og:title"/> <meta content="https://www.chicagomag.com/wp-content/archive/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Old-Oak-Tap-BLT/01-Old-Oak-Trap-BLT-500.jpg" property="og:image"/> <link href="https://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Old-Oak-Tap-BLT/" rel="canonical"> <meta content="https://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Old-Oak-Tap-BLT/" property="og:url"/> <meta content="Chicago Magazine" property="og:site_name"/> <!--<meta property="article:tag" content="" />--> <meta content="Chicago Magazine" property="article:section"/> <!-- <meta property="article:published_time" content="" /> <meta property="article:modified_time" content="" /> <meta property="og:updated_time" content="" /> --> <meta content="summary_large_image" name="twitter:card"/> <meta content="https://www.chicagomag.com/wp-content/archive/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Old-Oak-Tap-BLT/01-Old-Oak-Trap-BLT-500.jpg" name="twitter:image"/> <meta content="" inspired.""="" name="twitter:description" truly=""/> <meta content="1. Old Oak Tap BLT" name="twitter:title"/> <!-- end seo fields --> <!-- GA Google Analytics @ https://m0n.co/ga --> <script async="" src="https://www.googletagmanager.com/gtag/js?id=UA-297666-1"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-297666-1'); </script> <!-- start chartbeat code --> <script type="text/javascript"> (function() { /** CONFIGURATION START **/ var _sf_async_config = window._sf_async_config = (window._sf_async_config || {}); _sf_async_config.uid = 25745; _sf_async_config.domain = 'chicagomag.com'; _sf_async_config.flickerControl = false; _sf_async_config.useCanonical = true; _sf_async_config.useCanonicalDomain = true; _sf_async_config.sections = 'Chicago Magazine'; _sf_async_config.authors = 'Chicago Magazine'; /** CONFIGURATION END **/ function loadChartbeat() { var e = document.createElement('script'); var n = document.getElementsByTagName('script')[0]; e.type = 'text/javascript'; e.async = true; e.src = '//static.chartbeat.com/js/chartbeat.js'; n.parentNode.insertBefore(e, n); } loadChartbeat(); })(); </script> <script async="" src="//static.chartbeat.com/js/chartbeat_mab.js"></script> <!-- end chartbeat code --> <!-- Start GPT Tag --> <script async="" src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script> <!-- noodle nirvana --> <script> window.googletag = window.googletag || {cmd: []}; googletag.cmd.push(function() { googletag.defineSlot('/4011/trb.chicagomag/hp', [[728,90]], 'div-gpt-ad-2789321-1') .setTargeting('pos', ['1']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[728,90]], 'div-gpt-ad-2789321-2') .setTargeting('pos', ['2']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[728,90]], 'div-gpt-ad-2789321-3') .setTargeting('pos', ['3']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[728,90]], 'div-gpt-ad-2789321-4') .setTargeting('pos', ['4']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[728,90]], 'div-gpt-ad-2789321-5') .setTargeting('pos', ['5']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[320,50]], 'div-gpt-ad-2789321-6') .setTargeting('pos', ['1']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[320,50]], 'div-gpt-ad-2789321-7') .setTargeting('pos', ['2']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[320,50]], 'div-gpt-ad-2789321-8') .setTargeting('pos', ['3']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[320,50]], 'div-gpt-ad-2789321-9') .setTargeting('pos', ['4']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[320,50]], 'div-gpt-ad-2789321-10') .setTargeting('pos', ['5']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[300,250]], 'div-gpt-ad-2789321-11') .setTargeting('pos', ['1']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[300,250],[300,600]], 'div-gpt-ad-2789321-12') .setTargeting('pos', ['2']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[300,250]], 'div-gpt-ad-2789321-13') .setTargeting('pos', ['3']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[300,250]], 'div-gpt-ad-2789321-14') .setTargeting('pos', ['4']) .addService(googletag.pubads()); googletag.defineSlot('/4011/trb.chicagomag/hp', [[300,250]], 'div-gpt-ad-2789321-15') .setTargeting('pos', ['2']) .addService(googletag.pubads()); googletag.pubads().setTargeting('adcat', ['dining-drinking']); googletag.enableServices(); }); </script> <!-- End GPT Tag --> <!-- below is header style for all pages besides home --> <style> /* logo / nav -------------------------------------------------------------- */ .site-header { width: 18% !important; display: table !important; float: left !important; height: 90px; } .inside-header { display: table-cell !important; vertical-align: bottom !important; padding: 0 !important; padding-left: 5vw !important; } .main-navigation { width: 82% !important; display: table !important; position: relative !important; float: left !important; clear: inherit !important; height: 90px; } .inside-navigation { display: table-cell !important; vertical-align: bottom !important; padding-right: 5vw !important; text-align: right !important; } .main-navigation ul { border: 0 !important; line-height: 1em !important; } .main-navigation .main-nav ul li a { padding-left: 15px !important; padding-right: 15px !important; line-height: 1em !important; } .main-navigation .main-nav ul li:last-of-type a { padding-right: 0 !important; } /* layout -------------------------------------------------------------- */ .separate-containers .site-main { margin-top: 0 !important; } .post-template-single-package-child.separate-containers .site-main { margin-top: 3.05555vw !important; } @media only screen and (max-width: 1024px) { .site-header { width: 100% !important; display: block !important; float: none !important; height: inherit !important; } .main-navigation ul { border: 0 !important; line-height: 1em !important; } .main-navigation .main-nav ul li a { padding-left: 10px !important; padding-right: 10px !important; line-height: 1em !important; } .inside-header { display: block !important; vertical-align: inherit !important; padding: 3.75vw 0 0 0 !important; } .site-logo { display: inline-block; } .nav-aligned-center .main-navigation { text-align: center; } .main-navigation { width: 100% !important; display: inline-block !important; position: relative !important; float: none !important; clear: inherit !important; height: inherit !important; } .inside-navigation { display: inline-block !important; vertical-align: inherit !important; padding-right: 0 !important; text-align: center !important; margin: 0 auto !important; margin-top: 3.75vw !important; } } @media only screen and (max-width: 768px) { .site-header { width: 100% !important; display: table !important; float: left !important; height: 90px; } .main-navigation, .inside-navigation { display: none !important; } } </style> <style></style></link></meta></link></link></meta></head> <body class="post-template-default single single-post postid-11773 single-format-standard wp-custom-logo wp-embed-responsive no-sidebar nav-below-header separate-containers fluid-header active-footer-widgets-3 nav-aligned-center header-aligned-center dropdown-hover" itemscope="" itemtype="https://schema.org/Blog"> <div class="grid-toggle-wrap"><a class="grid-toggle">.</a></div> <div class="grid-guide"> <div class="grid-guide-col"><span>1</span></div> <div class="grid-guide-col"><span>2</span></div> <div class="grid-guide-col"><span>3</span></div> <div class="grid-guide-col"><span>4</span></div> <div class="grid-guide-col"><span>5</span></div> <div class="grid-guide-col"><span>6</span></div> <div class="grid-guide-col"><span>7</span></div> <div class="grid-guide-col"><span>8</span></div> <div class="grid-guide-col"><span>9</span></div> <div class="grid-guide-col"><span>10</span></div> <div class="grid-guide-col"><span>11</span></div> <div class="grid-guide-col"><span>12</span></div> <div class="grid-guide-col"><span>13</span></div> <div class="grid-guide-col"><span>14</span></div> <div class="grid-guide-col"><span>15</span></div> <div class="grid-guide-col"><span>16</span></div> <div class="grid-guide-col"><span>17</span></div> <div class="grid-guide-col"><span>18</span></div> <div class="grid-guide-col"><span>19</span></div> <div class="grid-guide-col"><span>20</span></div> <div class="grid-guide-col"><span>21</span></div> <div class="grid-guide-col"><span>22</span></div> <div class="grid-guide-col"><span>23</span></div> <div class="grid-guide-col"><span>24</span></div> </div> <div class="ad-space ad-space-leader top-ad-space hide-on-mobile"> <!-- GPT AdSlot 1 for Ad unit 'trb.chicagomag/hp' ### Size: [[728,90]] --> <div id="div-gpt-ad-2789321-1"> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-2789321-1'); }); </script> </div> <!-- End AdSlot 1 --> </div> <div class="ad-space ad-space-leader top-ad-space hide-on-desktop hide-on-tablet"> <!-- GPT AdSlot 6 for Ad unit 'trb.chicagomag/hp' ### Size: [[320,50]] --> <div id="div-gpt-ad-2789321-6"> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-2789321-6'); }); </script> </div> <!-- End AdSlot 6 --> </div> <div id="nav2-open"> <a class="nav2-toggle"><i class="fa fa-bars"></i></a> </div> <div id="nav2-close"> <a class="nav2-toggle"><i class="fa fa-times"></i></a> </div> <div id="nav2-overlay"></div> <div id="nav2-overlay-top"></div> <div id="nav2-overlay-btm"></div> <div id="nav2-inner-overlay"> <div id="nav2-inner"> <div class="grid-container grid-parent"> <div class="grid-5 prefix-1 suffix-1 nav2-cover hide-on-mobile"> <img src="/wp-content/uploads/2020/12/logo-alt.jpg"/> <img src=""/> <a href="https://cma.pcdfusion.com/pcd/Order?iKey=I**D7B" target="_blank">Subscribe</a> <a href="">Newsletters</a> <a class="nav-social" href="https://www.facebook.com/ChicagoMagazine" target="_blank"><i class="fab fa-facebook-f"></i></a> <a class="nav-social" href="http://www.twitter.com/chicagomag/" target="_blank"><i class="fab fa-twitter"></i></a> <a class="nav-social" href="http://instagram.com/chicagomag" target="_blank"><i class="fab fa-instagram"></i></a> <a class="nav-social" href="https://www.youtube.com/channel/UCOkRC6Y4LUyvglGmyC52KPw" target="_blank"><i class="fab fa-youtube"></i></a> </div> <div class="grid-100 nav2-cover hide-on-desktop"> <img src="/wp-content/uploads/2020/12/logo-alt.jpg"/> <form action="https://www.chicagomag.com/" class="search-form" method="get"> <label> <span class="screen-reader-text">Search for:</span> <input class="search-field" name="s" placeholder="Search …" title="Search for:" type="search" value=""/> </label> <input class="search-submit" type="submit" value="Search"/></form> </div> <div class="grid-7 prefix-1 suffix-1 mobile-grid-100 mobile-prefix-0 mobile-suffix-0"> <div class="section-header"> <div class="section-divide"></div> <h2>Sections</h2> </div> <a href="https://www.chicagomag.com/news/">News & Politics</a> <a href="https://www.chicagomag.com/dining-drinking/">Dining & Drinking</a> <a href="https://www.chicagomag.com/city-life/">City Life</a> <a href="https://www.chicagomag.com/arts-culture/">Culture</a> <a href="https://www.chicagomag.com/real-estate/">Real Estate</a> <a href="https://www.chicagomag.com/style-shopping/">Style</a> <div class="section-header"> <div class="section-divide"></div> <h2>Featured</h2> </div> <a href="https://www.chicagomag.com/video/">Video</a> <a href="https://www.chicagomag.com/long-reads/">Long Reads</a> <a href="https://www.chicagomag.com/chicago-magazine/april-2020/best-new-restaurants-11/">Best New Restaurants</a> <a href="https://www.chicagomag.com/top-doctors/">Top Doctors</a> </div> <div class="grid-7 suffix-1 mobile-grid-100 mobile-suffix-1"> <div class="section-header"> <div class="section-divide"></div> <h2>Magazine</h2> </div> <a href="https://www.chicagomag.com/issue-archive/">All Issues</a> <a href="https://cma.pcdfusion.com/pcd/Order?iKey=I**D7B">Subscribe</a> <a href="https://cma.pcdfusion.com/pcd/CustomerSupport/Account/Login?ReturnUrl=%2fpcd%2fCustomerSupport%2fApp%2f3141">Manage Subscription</a> <a href="https://www.chicagomag.com/advertise/">Advertise</a> <div class="section-header"> <div class="section-divide"></div> <h2>More</h2> </div> <a href="https://www.chicagomag.com/events/">Events</a> <a href="https://www.chicagomag.com/about-the-magazine/">About Us</a> <a href="https://www.chicagomag.com/contact-us/">Contact Us</a> <a href="https://www.chicagomag.com/follow-us/">Follow Us</a> <a href="https://www.chicagomag.com/resource-guide/">Resource Guide</a> </div> <div class="mobile-grid-100 hide-on-desktop" style="margin-bottom: 10vw;"> <img src="/wp-content/archive/Chicago-Magazine/December-2020/CMAG1220.jpg" style="margin-top: 5vw;"/> <a href="https://cma.pcdfusion.com/pcd/Order?iKey=I**D7B">Subscribe</a> <a href="">Newsletters</a> <a class="nav-social" href="https://www.facebook.com/ChicagoMagazine" target="_blank"><i class="fab fa-facebook-f"></i></a> <a class="nav-social" href="http://www.twitter.com/chicagomag/" target="_blank"><i class="fab fa-twitter"></i></a> <a class="nav-social" href="http://instagram.com/chicagomag" target="_blank"><i class="fab fa-instagram"></i></a> <a class="nav-social" href="https://www.youtube.com/channel/UCOkRC6Y4LUyvglGmyC52KPw" target="_blank"><i class="fab fa-youtube"></i></a> </div> </div> </div> </div> <div id="top-right-nav"> <div id="search-overlay"> <div id="search-close"> <a class="search-close-btn"> <i class="fas fa-times"></i> </a> </div> <form action="https://www.chicagomag.com/" class="search-form" method="get"> <label> <span class="screen-reader-text">Search for:</span> <input class="search-field" name="s" placeholder="Search …" title="Search for:" type="search" value=""/> </label> <input class="search-submit" type="submit" value="Search"/></form> </div> <div class="top-right-nav-links"> <a class="search-open"><i class="fa fa-search"></i></a> <a href="/events/">Events</a> <a href="https://cma.pcdfusion.com/pcd/Order?iKey=I**D7B">Subscribe</a> </div> </div> <div id="navbar"> <div id="nav2-open"> <a class="nav2-toggle"><i class="fa fa-bars"></i></a> </div> <a href="/"><img class="navbar-logo" src="/wp-content/uploads/2020/10/logo.png"/></a> </div> <a class="screen-reader-text skip-link" href="#content" title="Skip to content">Skip to content</a> <header class="site-header" id="masthead" itemscope="" itemtype="https://schema.org/WPHeader"> <div class="inside-header grid-container grid-parent"> <div class="site-logo"> <a href="https://www.chicagomag.com/" rel="home" title="Chicago Magazine"> <img alt="Chicago Magazine" class="header-image is-logo-image" src="https://www.chicagomag.com/wp-content/uploads/2020/10/logo.png" title="Chicago Magazine"> </img></a> </div> </div> </header> <nav class="main-navigation sub-menu-right" id="site-navigation" itemscope="" itemtype="https://schema.org/SiteNavigationElement"> <div class="inside-navigation grid-container grid-parent"> <button aria-controls="primary-menu" aria-expanded="false" class="menu-toggle"> <span class="mobile-menu">Menu</span> </button> <div class="main-nav" id="primary-menu"><ul class="menu sf-menu" id="menu-main"><li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-32855" id="menu-item-32855"><a href="https://www.chicagomag.com/news/">News & Politics</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-32856" id="menu-item-32856"><a href="https://www.chicagomag.com/dining-drinking/">Dining & Drinking</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-33687" id="menu-item-33687"><a href="https://www.chicagomag.com/city-life/">City Life</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-32857" id="menu-item-32857"><a href="https://www.chicagomag.com/arts-culture/">Culture</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-32858" id="menu-item-32858"><a href="https://www.chicagomag.com/real-estate/">Real Estate</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-32859" id="menu-item-32859"><a href="https://www.chicagomag.com/style-shopping/">Style</a></li> <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-29785" id="menu-item-29785"><a href="https://www.chicagomag.com/top-doctors/">Top Docs</a></li> </ul></div> </div> </nav> <div class="hfeed site grid-container container grid-parent" id="page"> <div class="site-content" id="content"> <div id="page-title"></div> <!-- start external content --> <!-- end external content --> <div class="content-area grid-parent mobile-grid-100 grid-100 tablet-grid-100" id="primary"> <main class="site-main" id="main"> <style> .article-wrap { margin-top: 2.22222vw !important; } .single .article-img { text-align: left; } @media only screen and (max-width: 1024px) { .container.grid-container { width: 100%; } .article-wrap .grid-10:first-of-type { display: none; } .article-side { padding-left: 0 !important; } .article-img { max-width: 100%; } } @media only screen and (max-width: 480px) { .site-header { width: 100% !important; height: 70px; } .main-navigation { display: none !important; } .article-body p, .article-body li { font-size: 18px; } .drop-cap { width: 70px; height: 70px; font-size: 60px; line-height: 70px; } .drop-cap-secondary { font-size: 60px; height: 45px; } } </style> <!-- start featured --> <!-- start super article featured image --> <!-- end super article featured image --> <!-- start head and deck --> <div class="grid-container grid-parent art-head-deck"> <div class="grid-12 prefix-5 tablet-grid-14 tablet-prefix-0 mobile-grid-100 mobile-prefix-0"> <div class="art-head h60">1. Old Oak Tap BLT</div> <div class="art-deck"><p>“Truly inspired.”</p> </div> <div class="art-byline-wrap"> </div> <div class="art-timestamp">October 9, 2012, 6:13 pm</div> <div class="heateor_sss_sharing_container heateor_sss_horizontal_sharing" heateor-sss-data-href="https://www.chicagomag.com/chicago-magazine/november-2012/best-sandwiches-in-chicago-old-oak-tap-blt/" ss-offset="0"><ul class="heateor_sss_sharing_ul"><li class="heateorSssSharingRound"><i alt="Facebook" class="heateorSssSharing heateorSssFacebookBackground" onclick='heateorSssPopup("https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fwww.chicagomag.com%2Fchicago-magazine%2Fnovember-2012%2Fbest-sandwiches-in-chicago-old-oak-tap-blt%2F")' style="width:24px;height:24px;border-radius:999px;" title="Facebook"><ss class="heateorSssSharingSvg heateorSssFacebookSvg" style="display:block;border-radius:999px;"></ss></i></li><li class="heateorSssSharingRound"><i alt="Twitter" class="heateorSssSharing heateorSssTwitterBackground" onclick='heateorSssPopup("http://twitter.com/intent/tweet?text=1.%20Old%20Oak%20Tap%20BLT&url=https%3A%2F%2Fwww.chicagomag.com%2Fchicago-magazine%2Fnovember-2012%2Fbest-sandwiches-in-chicago-old-oak-tap-blt%2F")' style="width:24px;height:24px;border-radius:999px;" title="Twitter"><ss class="heateorSssSharingSvg heateorSssTwitterSvg" style="display:block;border-radius:999px;"></ss></i></li><li class="heateorSssSharingRound"><i alt="Email" class="heateorSssSharing heateorSssEmailBackground" onclick="window.open('mailto:?subject=' + decodeURIComponent('1.%20Old%20Oak%20Tap%20BLT' ).replace('&', '%26') + '&body=' + decodeURIComponent('https%3A%2F%2Fwww.chicagomag.com%2Fchicago-magazine%2Fnovember-2012%2Fbest-sandwiches-in-chicago-old-oak-tap-blt%2F' ), '_blank')" style="width:24px;height:24px;border-radius:999px;" title="Email"><ss class="heateorSssSharingSvg heateorSssEmailSvg" style="display:block"></ss></i></li><li class="heateorSssSharingRound"><i alt="Copy Link" class="heateorSssSharing heateorSssCopyLinkBackground" style="width:24px;height:24px;border-radius:999px;" title="Copy Link"><ss class="heateorSssSharingSvg heateorSssCopyLinkSvg" style="display:block;border-radius:999px;"></ss></i></li><li class="heateorSssSharingRound"><i alt="Comment" class="heateorSssSharing heateorSssCommentBackground" style="width:24px;height:24px;border-radius:999px;" title="Comment"><a href="https://www.chicagomag.com/chicago-magazine/november-2012/best-sandwiches-in-chicago-old-oak-tap-blt/#respond" rel="nofollow"><ss class="heateorSssSharingSvg heateorSssCommentSvg" style="display:block"></ss></a></i></li></ul><div class="heateorSssClear"></div></div> </div> </div> <!-- end head and deck --> <!-- start featured image below meta data --> <div class="grid-container grid-parent featured-img"> <div class="grid-12 prefix-5 tablet-grid-14 tablet-prefix-0 mobile-grid-100 mobile-prefix-0"> <div class="article-img"> <figure> <img src="/wp-content/archive/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Old-Oak-Tap-BLT/01-Old-Oak-Trap-BLT-500.jpg"/> <figcaption> <span class="photo-credit">Photo: Anna Knott; Food stylist: Lisa Kuehl</span></figcaption> </figure> </div> </div> </div> <!-- end featured image below meta data --> <!-- end featured --> <!-- start article wrap --> <div class="grid-container grid-parent article-wrap"> <div class="grid-4 hide-on-tablet hide-on-mobile"> </div> <div class="grid-12 prefix-1 tablet-grid-14 tablet-prefix-0 suffix-1 mobile-grid-100 mobile-prefix-0 mobile-suffix-0"> <div class="article-body"> <p> The B is applewood smoked—nice and snappy. The L is arugula—fresh and peppery. The T is a fried green slice—jacketed in cornmeal and greaseless. Slathered with pimiento cheese, the grilled ciabatta somehow stays crisp, providing three distinct layers of crunch. Truly inspired.</p> <p class="addy"> <em>$10. 2109 W. Chicago Ave., 773-772-0406, <a href="http://www.theoldoaktap.com/">theoldoaktap.com</a></em></p> <aside class="story-nav-aside"> <a class="story-nav" href="http://www.chicagomag.com/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Phoebes-Bakery-The-Gatsby/" id="story-nav-left"><br/> <span class="previous">Previous</span><br/> <span class="story-nav-head">50. The Gatsby</span><br/> Phoebe’s Bakery<br/> </a><br/> <a class="story-nav" href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Au-Cheval-Fried-Bologna/" id="story-nav-right"><br/> <span class="next">Next</span><br/> <span class="story-nav-head">2. Fried Bologna</span><br/> Au Cheval<br/> </a><br/> </aside> </div> <div class="article-tags"> </div> </div> <div class="article-side grid-6 tablet-grid-9 mobile-grid-100 most-pop"> <div class="ad-space"> <!-- GPT AdSlot 12 for Ad unit 'trb.chicagomag/hp' ### Size: [[300,250],[300,600]] --> <div class="hide-on-mobile" id="div-gpt-ad-2789321-12"> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-2789321-12'); }); </script> </div> <!-- End AdSlot 12 --> <!-- GPT AdSlot 15 for Ad unit 'trb.chicagomag/hp' ### Size: [[300,250] --> <div class="hide-on-desktop hide-on-tablet" id="div-gpt-ad-2789321-15"> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-2789321-15'); }); </script> </div> <!-- End AdSlot 15 --> <!-- GPT AdSlot 11 for Ad unit 'trb.chicagomag/hp' ### Size: [[300,250]] --> <div id="div-gpt-ad-2789321-11"> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-2789321-11'); }); </script> </div> <!-- End AdSlot 11 --> </div> </div> </div> <!-- end article wrap --> <!-- start ad --> <div class="grid-container grid-parent ad-space ad-space-leader hide-on-mobile mb-0"> <!-- GPT AdSlot 5 for Ad unit 'trb.chicagomag/hp' ### Size: [[728,90]] --> <div id="div-gpt-ad-2789321-5"> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-2789321-5'); }); </script> </div> <!-- End AdSlot 5 --> </div> <div class="grid-container grid-parent ad-space ad-space-leader hide-on-desktop hide-on-tablet"> <!-- GPT AdSlot 10 for Ad unit 'trb.chicagomag/hp' ### Size: [[320,50]] --> <div id="div-gpt-ad-2789321-10"> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-2789321-10'); }); </script> </div> <!-- End AdSlot 10 --> </div> <!-- end ad --> <div class="comments-area grid-container grid-parent"> <div class="grid-12 prefix-5 mobile-grid-100 mobile-prefix-0"> <div id="comments"> <div class="comment-respond" id="respond"> <h3 class="comment-reply-title" id="reply-title">Leave a Comment <small><a href="/Chicago-Magazine/November-2012/Best-Sandwiches-in-Chicago-Old-Oak-Tap-BLT/#respond" id="cancel-comment-reply-link" rel="nofollow" style="display:none;">Cancel reply</a></small></h3><form action="https://www.chicagomag.com/wp-comments-post.php?wpe-comment-post=chicagomag" class="comment-form" id="commentform" method="post" novalidate=""><p class="comment-form-comment"><label class="screen-reader-text" for="comment">Comment</label><textarea aria-required="true" autocomplete="new-password" cols="45" id="a81c4f01c5" name="a81c4f01c5" required="" rows="8"></textarea><textarea aria-hidden="true" autocomplete="new-password" id="comment" name="comment" style="padding:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;position:absolute !important;white-space:nowrap !important;height:1px !important;width:1px !important;overflow:hidden !important;" tabindex="-1"></textarea><script data-noptimize="" type="text/javascript">document.getElementById("comment").setAttribute( "id", "a998b624fd411f97704acb1cff3ae2cf" );document.getElementById("a81c4f01c5").setAttribute( "id", "comment" );</script></p><label class="screen-reader-text" for="author">Name</label><input id="author" name="author" placeholder="Name *" size="30" type="text" value=""> <label class="screen-reader-text" for="email">Email</label><input id="email" name="email" placeholder="Email *" size="30" type="email" value=""> <label class="screen-reader-text" for="url">Website</label><input id="url" name="url" placeholder="Website" size="30" type="url" value=""> <p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"> <label for="wp-comment-cookies-consent">Save my name, email, and website in this browser for the next time I comment.</label></input></p> <p class="form-submit"><input class="submit" id="submit" name="submit" type="submit" value="Post Comment"/> <input id="comment_post_ID" name="comment_post_ID" type="hidden" value="11773"/> <input id="comment_parent" name="comment_parent" type="hidden" value="0"/> </p></input></input></input></form> </div><!-- #respond --> </div><!-- #comments --> </div> </div> </main><!-- #main --> </div><!-- #primary --> </div><!-- #content --> </div><!-- #page --> <!-- start footer --> <div id="footer"> <div class="grid-container"> <div class="grid-5 suffix-1 mobile-grid-12 mobile-suffix-0 grid-parent-mobile left"> <div class="wrap"> <a href="https://cma.pcdfusion.com/pcd/Order?iKey=I**D7B">Subscribe</a> <a href="https://cma.pcdfusion.com/pcd/CustomerSupport/Account/Login?ReturnUrl=%2fpcd%2fCustomerSupport%2fApp%2f3141">Manage Subscription</a> <a href="https://www.chicagomag.com/issue-archive/">Issue Archive</a> <a href="http://www.tronc.com/privacy-policy/">Privacy Policy</a> <a href="http://www.tronc.com/central-terms-of-service/">Terms of Service</a> </div> </div> <div class="grid-10 prefix-1 suffix-1 mobile-grid-100 mobile-prefix-0 grid-parent-mobile middle hide-on-mobile"> <div class="wrap"> <h2>Follow Us</h2> <div class="footer-social"> <a href="https://www.facebook.com/ChicagoMagazine" target="_blank"><i class="fab fa-facebook-f"></i></a> <a href="http://www.twitter.com/chicagomag/" target="_blank"><i class="fab fa-twitter"></i></a> <a href="http://instagram.com/chicagomag" target="_blank"><i class="fab fa-instagram"></i></a> <a href="https://www.youtube.com/channel/UCOkRC6Y4LUyvglGmyC52KPw" target="_blank"><i class="fab fa-youtube"></i></a> </div> <h2>Get Our Newsletters</h2> <p>Subscribe to one or more of our free e-mail newsletters to get instant updates on local news, events, and opportunities in Chicago.</p> <div class="footer-form" style="display:flex; margin-top:60px;"> <table> <tr> <td><input type="text"/></td> <td><button style="background:#d2232a; color:#fff;">Sign Up</button></td> </tr> </table> </div> <div class="copyright">©2020 Chicago magazine / A Chicago Tribune Media Group website</div> </div> </div> <div class="grid-5 prefix-1 mobile-grid-12 mobile-prefix-0 mobile-suffix-0 grid-parent-mobile right"> <div class="wrap"> <a href="https://www.chicagomag.com/about-the-magazine/">About the Magazine</a> <a href="https://www.chicagomag.com/contact-us/">Contact Us</a> <a href="https://www.chicagomag.com/advertise/">Advertise</a> <a href="https://www.chicagomag.com/resource-guide/">Resource Guide</a> <a href="https://www.chicagomag.com/events/">Events</a> </div> </div> <div class="mobile-grid-100 mobile-prefix-0 mobile-suffix-1 grid-parent-mobile middle hide-on-desktop hide-on-tablet"> <div class="wrap"> <h2>Follow Us</h2> <div class="footer-social"> <a href="https://www.facebook.com/ChicagoMagazine" target="_blank"><i class="fab fa-facebook-f"></i></a> <a href="http://www.twitter.com/chicagomag/" target="_blank"><i class="fab fa-twitter"></i></a> <a href="http://instagram.com/chicagomag" target="_blank"><i class="fab fa-instagram"></i></a> <a href="https://www.youtube.com/channel/UCOkRC6Y4LUyvglGmyC52KPw" target="_blank"><i class="fab fa-youtube"></i></a> </div> <h2>Get Our Newsletters</h2> <p>Subscribe to one or more of our free e-mail newsletters to get instant updates on local news, events, and opportunities in Chicago.</p> <div class="footer-form" style="display:flex; margin-top:60px;"> <input style="width:80%;" type="text"/> <button style="width:20%; background:#d2232a; color:#fff;">Sign Up</button> </div> <div class="copyright">©2020 Chicago magazine / A Chicago Tribune Media Group website</div> </div> </div> </div> </div> <!-- end footer --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> jQuery(document).ready(function($) { $(".grid-toggle").click(function(){ $(".grid-guide").toggle(); }); $(".nav2-toggle").click(function(){ $("#nav2-overlay").toggle(); $("#nav2-overlay-top").toggle(); $("#nav2-overlay-btm").toggle(); $("#nav2-inner-overlay").toggle(); $("#nav2-inner").toggle(); $("#nav2-open").toggle(); $("#nav2-close").toggle(); }); $(".search-open").click(function(){ $('#search-overlay').fadeIn().css('display', 'inline-block'); $('.search-field').focus(); //$('#search-close').fadeIn().css('display', 'block'); }); $(".search-close-btn").click(function(){ $("#search-overlay").fadeOut().toggle(); $("#search-close").fadeOut().toggle(); }); }); </script> <script> jQuery(document).ready(function($) { $(".toggle-rock").click(function(){ $('.indie-rock').fadeOut().css('display', 'none'); $('.new-music').fadeOut().css('display', 'none'); $('.rock').fadeIn().css('display', 'block'); }); $(".toggle-indie-rock").click(function(){ $('.rock').fadeOut().css('display', 'none'); $('.new-music').fadeOut().css('display', 'none'); $('.indie-rock').fadeIn().css('display', 'block'); }); $(".toggle-new-music").click(function(){ $('.indie-rock').fadeOut().css('display', 'none'); $('.rock').fadeOut().css('display', 'none'); $('.new-music').fadeIn().css('display', 'block'); }); $(".toggle-all-genre").click(function(){ $('.indie-rock').fadeIn().css('display', 'block'); $('.rock').fadeIn().css('display', 'block'); $('.new-music').fadeIn().css('display', 'block'); }); }); </script> <div class="site-footer"> <footer class="site-info" itemscope="" itemtype="https://schema.org/WPFooter"> <div class="inside-site-info grid-container grid-parent"> <div class="copyright-bar"> <span class="copyright">© 2021 Chicago Magazine</span> • Built with <a href="https://generatepress.com" itemprop="url">GeneratePress</a> </div> </div> </footer> </div><!-- .site-footer --> <!--[if lte IE 11]> <script src='https://www.chicagomag.com/wp-content/themes/generatepress/assets/js/classList.min.js?ver=3.0.2' id='generate-classlist-js'></script> <![endif]--> <script id="generate-main-js-extra"> var generatepressMenu = {"toggleOpenedSubMenus":"1","openSubMenuLabel":"Open Sub-Menu","closeSubMenuLabel":"Close Sub-Menu"}; </script> <script id="generate-main-js" src="https://www.chicagomag.com/wp-content/themes/generatepress/assets/js/main.min.js?ver=3.0.2"></script> <script id="comment-reply-js" src="https://www.chicagomag.com/wp-includes/js/comment-reply.min.js?ver=5.6"></script> <script id="heateor_sss_sharing_js-js-before"> function heateorSssLoadEvent(e) {var t=window.onload;if (typeof window.onload!="function") {window.onload=e}else{window.onload=function() {t();e()}}}; var heateorSssSharingAjaxUrl = 'https://www.chicagomag.com/wp-admin/admin-ajax.php', heateorSssCloseIconPath = 'https://www.chicagomag.com/wp-content/plugins/sassy-social-share/public/../images/close.png', heateorSssPluginIconPath = 'https://www.chicagomag.com/wp-content/plugins/sassy-social-share/public/../images/logo.png', heateorSssHorizontalSharingCountEnable = 0, heateorSssVerticalSharingCountEnable = 0, heateorSssSharingOffset = -10; var heateorSssMobileStickySharingEnabled = 0;var heateorSssCopyLinkMessage = "Link copied.";var heateorSssUrlCountFetched = [], heateorSssSharesText = 'Shares', heateorSssShareText = 'Share';function heateorSssPopup(e) {window.open(e,"popUpWindow","height=400,width=600,left=400,top=100,resizable,scrollbars,toolbar=0,personalbar=0,menubar=no,location=no,directories=no,status")};var heateorSssWhatsappShareAPI = "web"; </script> <script id="heateor_sss_sharing_js-js" src="https://www.chicagomag.com/wp-content/plugins/sassy-social-share/public/js/sassy-social-share-public.js?ver=3.3.20"></script> <script id="__ytprefsfitvids__-js" src="https://www.chicagomag.com/wp-content/plugins/youtube-embed-plus-pro/scripts/fitvids.min.js?ver=13.4.2"></script> <script id="wp-embed-js" src="https://www.chicagomag.com/wp-includes/js/wp-embed.min.js?ver=5.6"></script> <script> // When the user scrolls down 20px from the top of the document, slide down the navbar window.onscroll = function() {scrollFunction()}; function scrollFunction() { if (document.body.scrollTop > 240 || document.documentElement.scrollTop > 240) { document.getElementById("navbar").style.top = "0"; } else { document.getElementById("navbar").style.top = "-45px"; } } </script> </body> </html>
print(soup_tmp.find('p', 'addy'))
<p class="addy"> <em>$10. 2109 W. Chicago Ave., 773-772-0406, <a href="http://www.theoldoaktap.com/">theoldoaktap.com</a></em></p>
위처럼 태그를 이용해서 찾는다. 원하는 정보가 다 나와있다. 주소와 가격과 전화번호까지 있다. 그럼 이 상태에서 text로 가져와서 빈 칸으로 나누면 된다.
price_tmp = soup_tmp.find('p','addy').get_text()
price_tmp
'\n$10. 2109 W. Chicago Ave., 773-772-0406, theoldoaktap.com'
일단 get.text()로 가지고 왔다. 원하는 내용은 다 있다.
price_tmp.split()
['$10.', '2109', 'W.', 'Chicago', 'Ave.,', '773-772-0406,', 'theoldoaktap.com']
그리고 split()을 적용하면 위 결과처럼 나타난다. 여기서 빨리 눈치를 채야하는 것은 가격은 제일 첫 번째이다. 그리고 가운데가 주소의 체계에 따라 칸 수가 바뀔수는 있지만 제일 뒤는 웹 주소고, 제일 뒤에서 두번째는 전화번호이다. 파이썬 리스트에서 제일 뒤는 -1로 호출할 수 있다.
price_tmp.split()[0]
'$10.'
맨 뒤에 점이 붙어서 아래와 같이 사용하자.
price_tmp.split()[0][:-1]
'$10'
앞에 리스트를 기준으로 두 번째부터 맨 마지막에서 세 번째까지 선택하고 싶은데 그렇게 해도 list 형인것은 변함없다. 바로 하나의 문장을 만들고 싶은 것입니다. 이럴 때 사용하는 명령이 join 명령이다.
' '.join(price_tmp.split()[1:-2])
'2109 W. Chicago Ave.,'
이렇게 사용할 수 있다. 바로 주소가 되는 것이다.
출처 : 파이썬으로 데이터 주무르기
'파이썬으로 데이터 주무르기' 카테고리의 다른 글
파이썬으로 데이터 주무르기 ch.4 (0) | 2021.04.03 |
---|---|
파이썬으로 데이터 주무르기 ch.3-2 (0) | 2021.04.02 |
파이썬으로 데이터 주무르기 ch.2-2 (0) | 2021.03.31 |
파이썬으로 데이터 주무르기 ch.2-1 (0) | 2021.03.30 |
파이썬으로 데이터 주무르기 chapter.1 (0) | 2021.03.28 |