본문 바로가기

Programming [Python]/백준 알고리즘 솔루션

#214 백준 파이썬 [9987] 포켓몬 마스터 - 웹크롤링

https://www.acmicpc.net/problem/9987

 

#Solution

데이터의 크롤링, html 파싱 전 과정을 익혀야 풀 수 있는 문제다. +예전과 바뀐 포켓몬스터 (이제는 없어져버린 포켓몬들...)들에 대한 고민을 하지 않아도 된다. 아카이브에 저장된 페이지를 기반으로 하기 때문이다. 2일 밤낮을 세워 데이터 크롤링을 하나씩 살펴보자.

 

#1 웹 크롤링을 위한 준비

from bs4 import BeautifulSoup
import requests
import re

 

우선 웹크롤링의 필수 패키지인 BeautifulSoup4와, 인터넷으로 url요청 기능을 할 requests 패키지, 그리고 개떡 같은 HTML사이에서 의미 있는 단어를 찾아내기 위한 정규표현식 re 패키지를 임포트 해준다. 정규식은 쓸 수도 안 쓸 수도 있다.(안쓰면 행복하다)

 

 

#2 끌어온 html을 변수에 저장하기

html = requests.get("http://web.archive.org/web/20140301191716/http://pokemondb.net/pokedex/national")
html = html.content
soup = BeautifulSoup(html, 'html5lib')

requests.get으로 원하는 사이트에서 html을 전부 끌어온다! 이후 html.content를 통해 내용만 저장해주고, 다시 beautiful soup를 이용하기 위해 해당 패키지에 넣어준다. 뒤에 'html5lib'은 파싱 방법을 의미하는데 html5lib은 가장 느린 방법이고 lxml등 다양하고 빠른 방법의 툴이 존재하니 서치해보도록 한다.

 

 

#3 의미 있는(크롤할) 부분 확인하기

<!DOCTYPE html>
<html lang="en"><head><script src="//archive.org/includes/analytics.js?v=cf34f82" type="text/javascript"></script>
<script type="text/javascript">window.addEventListener('DOMContentLoaded',function(){var v=archive_analytics.values;v.service='wb';v.server_name='wwwb-app56.us.archive.org';v.server_ms=812;archive_analytics.send_pageview({});});</script><script charset="utf-8" src="/_static/js/ait-client-rewrite.js" type="text/javascript"></script>
<script type="text/javascript">
WB_wombat_Init("http://web.archive.org/web/", "20140301191716", "pokemondb.net");
</script>
<script charset="utf-8" src="/_static/js/wbhack.js" type="text/javascript"></script>
<script type="text/javascript">
__wbhack.init('http://web.archive.org/web');
</script>
<link href="/_static/css/banner-styles.css" rel="stylesheet" type="text/css"/>
<link href="/_static/css/iconochive.css" rel="stylesheet" type="text/css"/>
<!-- End Wayback Rewrite JS Include -->

.
.
.
.

 

html은 위처럼 코딩하기는 쉽지만 아주 더럽게 제 3자가 확인하기 어려운 구석이 많다. 따라서 내가 긁어오고자 하는 부분을 먼저 확인해야 한다. 

 

해당 페이지에 들어가서 F12(맥북 기준)을 눌러 오른쪽 개발도구 창을 열어준다. (어렸을 때 아무것도 모르고 눌러서 고장난 줄 알고 황급히 껐던 바로 그 창이다.)

 

여기서 개발도구 창 제일 왼쪽 위에 있는 버튼을 눌러준다.

바로 요 화살표 버튼!

이후 자신이 원하는 부분을 클릭하면 html상에서 어떤 부분에 해당 정보가 코딩이 되어있는지 직관적으로 알 수 있다.

 

왼쪽 커서 부분 모습

창에는 이처럼 보여주고

개발도구창 모습

개발도구 창에는 이렇게 보여준다.

창에 직접 나타나는 팝업 창은 웹디자이너들을 위한 폰트, 컬러 등등을 표시해주고, 이렇게 오른쪽 창은 HTML상에서 어떤 부분에 있는지 보여준다.

여기서 이상해씨(Bulbasaur)는

<article class~ 뭐시기> 아래 <div class 뭐시기> 아래 <span class뭐시기>아래 <a class>에 위치해있다는 것을 확인할 수 있다.

class는 테이블 명이고

href는 하이퍼 텍스트 url 주소이며

Bulbbasaur이 이 친구 이름이다

어디에 위치하는지 알았으니 반복되는 구간을 찾아야 한다. 모든 포켓몬의 이름을 뽑아야 하니까!

확인 결과 span class = 'infocard-tall'을 기준으로 1번 포켓몬부터 700번대 포켓몬까지 반복하는 것을 확인했다.

따라서 우리는 이 단계를 기점으로 이름만을 쏙쏙 골라먹을 것이다.


 

#4 포켓몬 이름 발라내기

pokemon_name = soup.find('div', class_= 'infocard-tall-list').find_all('a', class_= 'ent-name')
#div의 클래스 infocard-tall-list의 하위 단계 중 모든 ent-name 클래스를 발라낸다.

#포켓몬 이름 입력
result_name = []

for i in range(len(pokemon_name)):
    name = pokemon_name[i].text #text메써드로 간단하게 포켓몬 이름을 발라낼 수 있다.
    result_name.append(name)

find함수와 find_all함수를 통해 A의 하위 단계 내의 모든 B를 발라낼 수 있다. 앞으로 모든 크롤링의 기본이 되는 함수 사용법이다.

<a class="ent-name" href="/web/20140301191716/http://pokemondb.net/pokedex/bulbasaur">Bulbasaur</a>

처음에는 위처럼 발라내 진다. 여기서 우리는 Bulbasaur란 text만 가져오면 된다. 이는 .text 메써드로 손쉽게 해결 가능하다.

 

 

#5 포켓몬  숫자 발라내기

사실 1번부터 정렬이 되어있어 그냥 붙이면 되지만, 혹시나 변수가 있을 수도(빠진 수나, 오름순이 아닐 경우) 있기에 그대로 발라내준다.

pokemon_number = soup.find('div', class_= 'infocard-tall-list').find_all('span', class_= 'infocard-tall')

#포켓몬 넘버 입력
result_number = []
for num in range(len(pokemon_number)):
    result_number.append(int(pokemon_number[num].small.text[1:]))

find와 find_all함수를 통해 마찬가지로 넘버링이 되어있는 구간(#034 형식)을 발라내준다.

<span class="infocard-tall"><a class="pkg" data-sprite=" pkgRBY n1 " href="/web/20140301191716/http://pokemondb.net/pokedex/bulbasaur"></a><br/><small>#001</small><br/><a class="ent-name" href="/web/20140301191716/http://pokemondb.net/pokedex/bulbasaur">Bulbasaur</a><br/><small class="aside"><a class="itype grass" href="/web/20140301191716/http://pokemondb.net/type/grass">Grass</a> · <a class="itype poison" href="/web/20140301191716/http://pokemondb.net/type/poison">Poison</a></small></span>

그럼 이렇게 html이 나오는데, 여기서 이름과 마찬가지로 <small>#001</small>의 숫자를 발라내기 위해 .small 메써드와 .text메써드 그리고 [1:]으로 #만 발라내준다.

 

 

#6 포켓몬 타입 발라내기

pokemon_type = soup.find('div', class_= 'infocard-tall-list').find_all('small', class_= 'aside')

#포켓몬 타입 입력
result_type = []
for i in range(len(pokemon_type)):
    types = pokemon_type[i].text.split(' · ') #두 개 있을 경우
    result_type.append(types)

포켓몬 타입은 위와 마찬가지로 진행하지만, 하나 특이한 점은 1개 or 2개 씩 있다는 점이다. 따라서 split함수를 통해 리스트 형식으로 저장해준 뒤, 출력 시에 있으면 출력하고 아님 말고! 를 for문으로 돌려주자.

 

 

#7 포켓몬 도감 생성

자! 우리만의 포켓몬 도감을 맹글어보자.

#포켓몬 도감 생성
pokemon_dict = {}

for i in range(len(result_number)):
    pokemon_dict[result_number[i]] = [result_name[i], result_type[i]]

각각의 key는 물론 포켓몬 번호이고, 이름과 type을 인자로 삼는다.

 

 

#8 기준 맞게 포켓몬 출력하기

N = int(input())
print(pokemon_dict[N][0])
for types in pokemon_dict[N][1]:
    print(types, end = " ")

이렇게 출력하면 답을 맞출 수 있을 것이다.

 

백준에서 풀 때의 문제는 채점 시에 외부에서 끌어오는 기능(?)이나 외부 패키지를 전혀 사용하지 못하므로, 이렇게 긁어온 pokemon_dict를 그대로 복사하여 코드를 출력해야한다는 점이다.

 

웹크롤링 및 파싱의 기본을 다뤄봤다. 딱히 포켓몬이라서 열심히 설명한 것은 아니다. 엥? 파이리썬의 파이썬아니냐

 

아래는 크롤 후 나온 dict파일이다. 정답지

 

파이리썬!!!

{1: ['Bulbasaur', ['Grass', 'Poison']],
 2: ['Ivysaur', ['Grass', 'Poison']],
 3: ['Venusaur', ['Grass', 'Poison']],
 4: ['Charmander', ['Fire']],
 5: ['Charmeleon', ['Fire']],
 6: ['Charizard', ['Fire', 'Flying']],
 7: ['Squirtle', ['Water']],
 8: ['Wartortle', ['Water']],
 9: ['Blastoise', ['Water']],
 10: ['Caterpie', ['Bug']],
 11: ['Metapod', ['Bug']],
 12: ['Butterfree', ['Bug', 'Flying']],
 13: ['Weedle', ['Bug', 'Poison']],
 14: ['Kakuna', ['Bug', 'Poison']],
 15: ['Beedrill', ['Bug', 'Poison']],
 16: ['Pidgey', ['Normal', 'Flying']],
 17: ['Pidgeotto', ['Normal', 'Flying']],
 18: ['Pidgeot', ['Normal', 'Flying']],
 19: ['Rattata', ['Normal']],
 20: ['Raticate', ['Normal']],
 21: ['Spearow', ['Normal', 'Flying']],
 22: ['Fearow', ['Normal', 'Flying']],
 23: ['Ekans', ['Poison']],
 24: ['Arbok', ['Poison']],
 25: ['Pikachu', ['Electric']],
 26: ['Raichu', ['Electric']],
 27: ['Sandshrew', ['Ground']],
 28: ['Sandslash', ['Ground']],
 29: ['Nidoran♀', ['Poison']],
 30: ['Nidorina', ['Poison']],
 31: ['Nidoqueen', ['Poison', 'Ground']],
 32: ['Nidoran♂', ['Poison']],
 33: ['Nidorino', ['Poison']],
 34: ['Nidoking', ['Poison', 'Ground']],
 35: ['Clefairy', ['Fairy']],
 36: ['Clefable', ['Fairy']],
 37: ['Vulpix', ['Fire']],
 38: ['Ninetales', ['Fire']],
 39: ['Jigglypuff', ['Normal', 'Fairy']],
 40: ['Wigglytuff', ['Normal', 'Fairy']],
 41: ['Zubat', ['Poison', 'Flying']],
 42: ['Golbat', ['Poison', 'Flying']],
 43: ['Oddish', ['Grass', 'Poison']],
 44: ['Gloom', ['Grass', 'Poison']],
 45: ['Vileplume', ['Grass', 'Poison']],
 46: ['Paras', ['Bug', 'Grass']],
 47: ['Parasect', ['Bug', 'Grass']],
 48: ['Venonat', ['Bug', 'Poison']],
 49: ['Venomoth', ['Bug', 'Poison']],
 50: ['Diglett', ['Ground']],
 51: ['Dugtrio', ['Ground']],
 52: ['Meowth', ['Normal']],
 53: ['Persian', ['Normal']],
 54: ['Psyduck', ['Water']],
 55: ['Golduck', ['Water']],
 56: ['Mankey', ['Fighting']],
 57: ['Primeape', ['Fighting']],
 58: ['Growlithe', ['Fire']],
 59: ['Arcanine', ['Fire']],
 60: ['Poliwag', ['Water']],
 61: ['Poliwhirl', ['Water']],
 62: ['Poliwrath', ['Water', 'Fighting']],
 63: ['Abra', ['Psychic']],
 64: ['Kadabra', ['Psychic']],
 65: ['Alakazam', ['Psychic']],
 66: ['Machop', ['Fighting']],
 67: ['Machoke', ['Fighting']],
 68: ['Machamp', ['Fighting']],
 69: ['Bellsprout', ['Grass', 'Poison']],
 70: ['Weepinbell', ['Grass', 'Poison']],
 71: ['Victreebel', ['Grass', 'Poison']],
 72: ['Tentacool', ['Water', 'Poison']],
 73: ['Tentacruel', ['Water', 'Poison']],
 74: ['Geodude', ['Rock', 'Ground']],
 75: ['Graveler', ['Rock', 'Ground']],
 76: ['Golem', ['Rock', 'Ground']],
 77: ['Ponyta', ['Fire']],
 78: ['Rapidash', ['Fire']],
 79: ['Slowpoke', ['Water', 'Psychic']],
 80: ['Slowbro', ['Water', 'Psychic']],
 81: ['Magnemite', ['Electric', 'Steel']],
 82: ['Magneton', ['Electric', 'Steel']],
 83: ["Farfetch'd", ['Normal', 'Flying']],
 84: ['Doduo', ['Normal', 'Flying']],
 85: ['Dodrio', ['Normal', 'Flying']],
 86: ['Seel', ['Water']],
 87: ['Dewgong', ['Water', 'Ice']],
 88: ['Grimer', ['Poison']],
 89: ['Muk', ['Poison']],
 90: ['Shellder', ['Water']],
 91: ['Cloyster', ['Water', 'Ice']],
 92: ['Gastly', ['Ghost', 'Poison']],
 93: ['Haunter', ['Ghost', 'Poison']],
 94: ['Gengar', ['Ghost', 'Poison']],
 95: ['Onix', ['Rock', 'Ground']],
 96: ['Drowzee', ['Psychic']],
 97: ['Hypno', ['Psychic']],
 98: ['Krabby', ['Water']],
 99: ['Kingler', ['Water']],
 100: ['Voltorb', ['Electric']],
 101: ['Electrode', ['Electric']],
 102: ['Exeggcute', ['Grass', 'Psychic']],
 103: ['Exeggutor', ['Grass', 'Psychic']],
 104: ['Cubone', ['Ground']],
 105: ['Marowak', ['Ground']],
 106: ['Hitmonlee', ['Fighting']],
 107: ['Hitmonchan', ['Fighting']],
 108: ['Lickitung', ['Normal']],
 109: ['Koffing', ['Poison']],
 110: ['Weezing', ['Poison']],
 111: ['Rhyhorn', ['Ground', 'Rock']],
 112: ['Rhydon', ['Ground', 'Rock']],
 113: ['Chansey', ['Normal']],
 114: ['Tangela', ['Grass']],
 115: ['Kangaskhan', ['Normal']],
 116: ['Horsea', ['Water']],
 117: ['Seadra', ['Water']],
 118: ['Goldeen', ['Water']],
 119: ['Seaking', ['Water']],
 120: ['Staryu', ['Water']],
 121: ['Starmie', ['Water', 'Psychic']],
 122: ['Mr. Mime', ['Psychic', 'Fairy']],
 123: ['Scyther', ['Bug', 'Flying']],
 124: ['Jynx', ['Ice', 'Psychic']],
 125: ['Electabuzz', ['Electric']],
 126: ['Magmar', ['Fire']],
 127: ['Pinsir', ['Bug']],
 128: ['Tauros', ['Normal']],
 129: ['Magikarp', ['Water']],
 130: ['Gyarados', ['Water', 'Flying']],
 131: ['Lapras', ['Water', 'Ice']],
 132: ['Ditto', ['Normal']],
 133: ['Eevee', ['Normal']],
 134: ['Vaporeon', ['Water']],
 135: ['Jolteon', ['Electric']],
 136: ['Flareon', ['Fire']],
 137: ['Porygon', ['Normal']],
 138: ['Omanyte', ['Rock', 'Water']],
 139: ['Omastar', ['Rock', 'Water']],
 140: ['Kabuto', ['Rock', 'Water']],
 141: ['Kabutops', ['Rock', 'Water']],
 142: ['Aerodactyl', ['Rock', 'Flying']],
 143: ['Snorlax', ['Normal']],
 144: ['Articuno', ['Ice', 'Flying']],
 145: ['Zapdos', ['Electric', 'Flying']],
 146: ['Moltres', ['Fire', 'Flying']],
 147: ['Dratini', ['Dragon']],
 148: ['Dragonair', ['Dragon']],
 149: ['Dragonite', ['Dragon', 'Flying']],
 150: ['Mewtwo', ['Psychic']],
 151: ['Mew', ['Psychic']],
 152: ['Chikorita', ['Grass']],
 153: ['Bayleef', ['Grass']],
 154: ['Meganium', ['Grass']],
 155: ['Cyndaquil', ['Fire']],
 156: ['Quilava', ['Fire']],
 157: ['Typhlosion', ['Fire']],
 158: ['Totodile', ['Water']],
 159: ['Croconaw', ['Water']],
 160: ['Feraligatr', ['Water']],
 161: ['Sentret', ['Normal']],
 162: ['Furret', ['Normal']],
 163: ['Hoothoot', ['Normal', 'Flying']],
 164: ['Noctowl', ['Normal', 'Flying']],
 165: ['Ledyba', ['Bug', 'Flying']],
 166: ['Ledian', ['Bug', 'Flying']],
 167: ['Spinarak', ['Bug', 'Poison']],
 168: ['Ariados', ['Bug', 'Poison']],
 169: ['Crobat', ['Poison', 'Flying']],
 170: ['Chinchou', ['Water', 'Electric']],
 171: ['Lanturn', ['Water', 'Electric']],
 172: ['Pichu', ['Electric']],
 173: ['Cleffa', ['Fairy']],
 174: ['Igglybuff', ['Normal', 'Fairy']],
 175: ['Togepi', ['Fairy']],
 176: ['Togetic', ['Fairy', 'Flying']],
 177: ['Natu', ['Psychic', 'Flying']],
 178: ['Xatu', ['Psychic', 'Flying']],
 179: ['Mareep', ['Electric']],
 180: ['Flaaffy', ['Electric']],
 181: ['Ampharos', ['Electric']],
 182: ['Bellossom', ['Grass']],
 183: ['Marill', ['Water', 'Fairy']],
 184: ['Azumarill', ['Water', 'Fairy']],
 185: ['Sudowoodo', ['Rock']],
 186: ['Politoed', ['Water']],
 187: ['Hoppip', ['Grass', 'Flying']],
 188: ['Skiploom', ['Grass', 'Flying']],
 189: ['Jumpluff', ['Grass', 'Flying']],
 190: ['Aipom', ['Normal']],
 191: ['Sunkern', ['Grass']],
 192: ['Sunflora', ['Grass']],
 193: ['Yanma', ['Bug', 'Flying']],
 194: ['Wooper', ['Water', 'Ground']],
 195: ['Quagsire', ['Water', 'Ground']],
 196: ['Espeon', ['Psychic']],
 197: ['Umbreon', ['Dark']],
 198: ['Murkrow', ['Dark', 'Flying']],
 199: ['Slowking', ['Water', 'Psychic']],
 200: ['Misdreavus', ['Ghost']],
 201: ['Unown', ['Psychic']],
 202: ['Wobbuffet', ['Psychic']],
 203: ['Girafarig', ['Normal', 'Psychic']],
 204: ['Pineco', ['Bug']],
 205: ['Forretress', ['Bug', 'Steel']],
 206: ['Dunsparce', ['Normal']],
 207: ['Gligar', ['Ground', 'Flying']],
 208: ['Steelix', ['Steel', 'Ground']],
 209: ['Snubbull', ['Fairy']],
 210: ['Granbull', ['Fairy']],
 211: ['Qwilfish', ['Water', 'Poison']],
 212: ['Scizor', ['Bug', 'Steel']],
 213: ['Shuckle', ['Bug', 'Rock']],
 214: ['Heracross', ['Bug', 'Fighting']],
 215: ['Sneasel', ['Dark', 'Ice']],
 216: ['Teddiursa', ['Normal']],
 217: ['Ursaring', ['Normal']],
 218: ['Slugma', ['Fire']],
 219: ['Magcargo', ['Fire', 'Rock']],
 220: ['Swinub', ['Ice', 'Ground']],
 221: ['Piloswine', ['Ice', 'Ground']],
 222: ['Corsola', ['Water', 'Rock']],
 223: ['Remoraid', ['Water']],
 224: ['Octillery', ['Water']],
 225: ['Delibird', ['Ice', 'Flying']],
 226: ['Mantine', ['Water', 'Flying']],
 227: ['Skarmory', ['Steel', 'Flying']],
 228: ['Houndour', ['Dark', 'Fire']],
 229: ['Houndoom', ['Dark', 'Fire']],
 230: ['Kingdra', ['Water', 'Dragon']],
 231: ['Phanpy', ['Ground']],
 232: ['Donphan', ['Ground']],
 233: ['Porygon2', ['Normal']],
 234: ['Stantler', ['Normal']],
 235: ['Smeargle', ['Normal']],
 236: ['Tyrogue', ['Fighting']],
 237: ['Hitmontop', ['Fighting']],
 238: ['Smoochum', ['Ice', 'Psychic']],
 239: ['Elekid', ['Electric']],
 240: ['Magby', ['Fire']],
 241: ['Miltank', ['Normal']],
 242: ['Blissey', ['Normal']],
 243: ['Raikou', ['Electric']],
 244: ['Entei', ['Fire']],
 245: ['Suicune', ['Water']],
 246: ['Larvitar', ['Rock', 'Ground']],
 247: ['Pupitar', ['Rock', 'Ground']],
 248: ['Tyranitar', ['Rock', 'Dark']],
 249: ['Lugia', ['Psychic', 'Flying']],
 250: ['Ho-oh', ['Fire', 'Flying']],
 251: ['Celebi', ['Psychic', 'Grass']],
 252: ['Treecko', ['Grass']],
 253: ['Grovyle', ['Grass']],
 254: ['Sceptile', ['Grass']],
 255: ['Torchic', ['Fire']],
 256: ['Combusken', ['Fire', 'Fighting']],
 257: ['Blaziken', ['Fire', 'Fighting']],
 258: ['Mudkip', ['Water']],
 259: ['Marshtomp', ['Water', 'Ground']],
 260: ['Swampert', ['Water', 'Ground']],
 261: ['Poochyena', ['Dark']],
 262: ['Mightyena', ['Dark']],
 263: ['Zigzagoon', ['Normal']],
 264: ['Linoone', ['Normal']],
 265: ['Wurmple', ['Bug']],
 266: ['Silcoon', ['Bug']],
 267: ['Beautifly', ['Bug', 'Flying']],
 268: ['Cascoon', ['Bug']],
 269: ['Dustox', ['Bug', 'Poison']],
 270: ['Lotad', ['Water', 'Grass']],
 271: ['Lombre', ['Water', 'Grass']],
 272: ['Ludicolo', ['Water', 'Grass']],
 273: ['Seedot', ['Grass']],
 274: ['Nuzleaf', ['Grass', 'Dark']],
 275: ['Shiftry', ['Grass', 'Dark']],
 276: ['Taillow', ['Normal', 'Flying']],
 277: ['Swellow', ['Normal', 'Flying']],
 278: ['Wingull', ['Water', 'Flying']],
 279: ['Pelipper', ['Water', 'Flying']],
 280: ['Ralts', ['Psychic', 'Fairy']],
 281: ['Kirlia', ['Psychic', 'Fairy']],
 282: ['Gardevoir', ['Psychic', 'Fairy']],
 283: ['Surskit', ['Bug', 'Water']],
 284: ['Masquerain', ['Bug', 'Flying']],
 285: ['Shroomish', ['Grass']],
 286: ['Breloom', ['Grass', 'Fighting']],
 287: ['Slakoth', ['Normal']],
 288: ['Vigoroth', ['Normal']],
 289: ['Slaking', ['Normal']],
 290: ['Nincada', ['Bug', 'Ground']],
 291: ['Ninjask', ['Bug', 'Flying']],
 292: ['Shedinja', ['Bug', 'Ghost']],
 293: ['Whismur', ['Normal']],
 294: ['Loudred', ['Normal']],
 295: ['Exploud', ['Normal']],
 296: ['Makuhita', ['Fighting']],
 297: ['Hariyama', ['Fighting']],
 298: ['Azurill', ['Normal', 'Fairy']],
 299: ['Nosepass', ['Rock']],
 300: ['Skitty', ['Normal']],
 301: ['Delcatty', ['Normal']],
 302: ['Sableye', ['Dark', 'Ghost']],
 303: ['Mawile', ['Steel', 'Fairy']],
 304: ['Aron', ['Steel', 'Rock']],
 305: ['Lairon', ['Steel', 'Rock']],
 306: ['Aggron', ['Steel', 'Rock']],
 307: ['Meditite', ['Fighting', 'Psychic']],
 308: ['Medicham', ['Fighting', 'Psychic']],
 309: ['Electrike', ['Electric']],
 310: ['Manectric', ['Electric']],
 311: ['Plusle', ['Electric']],
 312: ['Minun', ['Electric']],
 313: ['Volbeat', ['Bug']],
 314: ['Illumise', ['Bug']],
 315: ['Roselia', ['Grass', 'Poison']],
 316: ['Gulpin', ['Poison']],
 317: ['Swalot', ['Poison']],
 318: ['Carvanha', ['Water', 'Dark']],
 319: ['Sharpedo', ['Water', 'Dark']],
 320: ['Wailmer', ['Water']],
 321: ['Wailord', ['Water']],
 322: ['Numel', ['Fire', 'Ground']],
 323: ['Camerupt', ['Fire', 'Ground']],
 324: ['Torkoal', ['Fire']],
 325: ['Spoink', ['Psychic']],
 326: ['Grumpig', ['Psychic']],
 327: ['Spinda', ['Normal']],
 328: ['Trapinch', ['Ground']],
 329: ['Vibrava', ['Ground', 'Dragon']],
 330: ['Flygon', ['Ground', 'Dragon']],
 331: ['Cacnea', ['Grass']],
 332: ['Cacturne', ['Grass', 'Dark']],
 333: ['Swablu', ['Normal', 'Flying']],
 334: ['Altaria', ['Dragon', 'Flying']],
 335: ['Zangoose', ['Normal']],
 336: ['Seviper', ['Poison']],
 337: ['Lunatone', ['Rock', 'Psychic']],
 338: ['Solrock', ['Rock', 'Psychic']],
 339: ['Barboach', ['Water', 'Ground']],
 340: ['Whiscash', ['Water', 'Ground']],
 341: ['Corphish', ['Water']],
 342: ['Crawdaunt', ['Water', 'Dark']],
 343: ['Baltoy', ['Ground', 'Psychic']],
 344: ['Claydol', ['Ground', 'Psychic']],
 345: ['Lileep', ['Rock', 'Grass']],
 346: ['Cradily', ['Rock', 'Grass']],
 347: ['Anorith', ['Rock', 'Bug']],
 348: ['Armaldo', ['Rock', 'Bug']],
 349: ['Feebas', ['Water']],
 350: ['Milotic', ['Water']],
 351: ['Castform', ['Normal']],
 352: ['Kecleon', ['Normal']],
 353: ['Shuppet', ['Ghost']],
 354: ['Banette', ['Ghost']],
 355: ['Duskull', ['Ghost']],
 356: ['Dusclops', ['Ghost']],
 357: ['Tropius', ['Grass', 'Flying']],
 358: ['Chimecho', ['Psychic']],
 359: ['Absol', ['Dark']],
 360: ['Wynaut', ['Psychic']],
 361: ['Snorunt', ['Ice']],
 362: ['Glalie', ['Ice']],
 363: ['Spheal', ['Ice', 'Water']],
 364: ['Sealeo', ['Ice', 'Water']],
 365: ['Walrein', ['Ice', 'Water']],
 366: ['Clamperl', ['Water']],
 367: ['Huntail', ['Water']],
 368: ['Gorebyss', ['Water']],
 369: ['Relicanth', ['Water', 'Rock']],
 370: ['Luvdisc', ['Water']],
 371: ['Bagon', ['Dragon']],
 372: ['Shelgon', ['Dragon']],
 373: ['Salamence', ['Dragon', 'Flying']],
 374: ['Beldum', ['Steel', 'Psychic']],
 375: ['Metang', ['Steel', 'Psychic']],
 376: ['Metagross', ['Steel', 'Psychic']],
 377: ['Regirock', ['Rock']],
 378: ['Regice', ['Ice']],
 379: ['Registeel', ['Steel']],
 380: ['Latias', ['Dragon', 'Psychic']],
 381: ['Latios', ['Dragon', 'Psychic']],
 382: ['Kyogre', ['Water']],
 383: ['Groudon', ['Ground']],
 384: ['Rayquaza', ['Dragon', 'Flying']],
 385: ['Jirachi', ['Steel', 'Psychic']],
 386: ['Deoxys', ['Psychic']],
 387: ['Turtwig', ['Grass']],
 388: ['Grotle', ['Grass']],
 389: ['Torterra', ['Grass', 'Ground']],
 390: ['Chimchar', ['Fire']],
 391: ['Monferno', ['Fire', 'Fighting']],
 392: ['Infernape', ['Fire', 'Fighting']],
 393: ['Piplup', ['Water']],
 394: ['Prinplup', ['Water']],
 395: ['Empoleon', ['Water', 'Steel']],
 396: ['Starly', ['Normal', 'Flying']],
 397: ['Staravia', ['Normal', 'Flying']],
 398: ['Staraptor', ['Normal', 'Flying']],
 399: ['Bidoof', ['Normal']],
 400: ['Bibarel', ['Normal', 'Water']],
 401: ['Kricketot', ['Bug']],
 402: ['Kricketune', ['Bug']],
 403: ['Shinx', ['Electric']],
 404: ['Luxio', ['Electric']],
 405: ['Luxray', ['Electric']],
 406: ['Budew', ['Grass', 'Poison']],
 407: ['Roserade', ['Grass', 'Poison']],
 408: ['Cranidos', ['Rock']],
 409: ['Rampardos', ['Rock']],
 410: ['Shieldon', ['Rock', 'Steel']],
 411: ['Bastiodon', ['Rock', 'Steel']],
 412: ['Burmy', ['Bug']],
 413: ['Wormadam', ['Bug', 'Grass']],
 414: ['Mothim', ['Bug', 'Flying']],
 415: ['Combee', ['Bug', 'Flying']],
 416: ['Vespiquen', ['Bug', 'Flying']],
 417: ['Pachirisu', ['Electric']],
 418: ['Buizel', ['Water']],
 419: ['Floatzel', ['Water']],
 420: ['Cherubi', ['Grass']],
 421: ['Cherrim', ['Grass']],
 422: ['Shellos', ['Water']],
 423: ['Gastrodon', ['Water', 'Ground']],
 424: ['Ambipom', ['Normal']],
 425: ['Drifloon', ['Ghost', 'Flying']],
 426: ['Drifblim', ['Ghost', 'Flying']],
 427: ['Buneary', ['Normal']],
 428: ['Lopunny', ['Normal']],
 429: ['Mismagius', ['Ghost']],
 430: ['Honchkrow', ['Dark', 'Flying']],
 431: ['Glameow', ['Normal']],
 432: ['Purugly', ['Normal']],
 433: ['Chingling', ['Psychic']],
 434: ['Stunky', ['Poison', 'Dark']],
 435: ['Skuntank', ['Poison', 'Dark']],
 436: ['Bronzor', ['Steel', 'Psychic']],
 437: ['Bronzong', ['Steel', 'Psychic']],
 438: ['Bonsly', ['Rock']],
 439: ['Mime Jr.', ['Psychic', 'Fairy']],
 440: ['Happiny', ['Normal']],
 441: ['Chatot', ['Normal', 'Flying']],
 442: ['Spiritomb', ['Ghost', 'Dark']],
 443: ['Gible', ['Dragon', 'Ground']],
 444: ['Gabite', ['Dragon', 'Ground']],
 445: ['Garchomp', ['Dragon', 'Ground']],
 446: ['Munchlax', ['Normal']],
 447: ['Riolu', ['Fighting']],
 448: ['Lucario', ['Fighting', 'Steel']],
 449: ['Hippopotas', ['Ground']],
 450: ['Hippowdon', ['Ground']],
 451: ['Skorupi', ['Poison', 'Bug']],
 452: ['Drapion', ['Poison', 'Dark']],
 453: ['Croagunk', ['Poison', 'Fighting']],
 454: ['Toxicroak', ['Poison', 'Fighting']],
 455: ['Carnivine', ['Grass']],
 456: ['Finneon', ['Water']],
 457: ['Lumineon', ['Water']],
 458: ['Mantyke', ['Water', 'Flying']],
 459: ['Snover', ['Grass', 'Ice']],
 460: ['Abomasnow', ['Grass', 'Ice']],
 461: ['Weavile', ['Dark', 'Ice']],
 462: ['Magnezone', ['Electric', 'Steel']],
 463: ['Lickilicky', ['Normal']],
 464: ['Rhyperior', ['Ground', 'Rock']],
 465: ['Tangrowth', ['Grass']],
 466: ['Electivire', ['Electric']],
 467: ['Magmortar', ['Fire']],
 468: ['Togekiss', ['Fairy', 'Flying']],
 469: ['Yanmega', ['Bug', 'Flying']],
 470: ['Leafeon', ['Grass']],
 471: ['Glaceon', ['Ice']],
 472: ['Gliscor', ['Ground', 'Flying']],
 473: ['Mamoswine', ['Ice', 'Ground']],
 474: ['Porygon-Z', ['Normal']],
 475: ['Gallade', ['Psychic', 'Fighting']],
 476: ['Probopass', ['Rock', 'Steel']],
 477: ['Dusknoir', ['Ghost']],
 478: ['Froslass', ['Ice', 'Ghost']],
 479: ['Rotom', ['Electric', 'Ghost']],
 480: ['Uxie', ['Psychic']],
 481: ['Mesprit', ['Psychic']],
 482: ['Azelf', ['Psychic']],
 483: ['Dialga', ['Steel', 'Dragon']],
 484: ['Palkia', ['Water', 'Dragon']],
 485: ['Heatran', ['Fire', 'Steel']],
 486: ['Regigigas', ['Normal']],
 487: ['Giratina', ['Ghost', 'Dragon']],
 488: ['Cresselia', ['Psychic']],
 489: ['Phione', ['Water']],
 490: ['Manaphy', ['Water']],
 491: ['Darkrai', ['Dark']],
 492: ['Shaymin', ['Grass']],
 493: ['Arceus', ['Normal']],
 494: ['Victini', ['Psychic', 'Fire']],
 495: ['Snivy', ['Grass']],
 496: ['Servine', ['Grass']],
 497: ['Serperior', ['Grass']],
 498: ['Tepig', ['Fire']],
 499: ['Pignite', ['Fire', 'Fighting']],
 500: ['Emboar', ['Fire', 'Fighting']],
 501: ['Oshawott', ['Water']],
 502: ['Dewott', ['Water']],
 503: ['Samurott', ['Water']],
 504: ['Patrat', ['Normal']],
 505: ['Watchog', ['Normal']],
 506: ['Lillipup', ['Normal']],
 507: ['Herdier', ['Normal']],
 508: ['Stoutland', ['Normal']],
 509: ['Purrloin', ['Dark']],
 510: ['Liepard', ['Dark']],
 511: ['Pansage', ['Grass']],
 512: ['Simisage', ['Grass']],
 513: ['Pansear', ['Fire']],
 514: ['Simisear', ['Fire']],
 515: ['Panpour', ['Water']],
 516: ['Simipour', ['Water']],
 517: ['Munna', ['Psychic']],
 518: ['Musharna', ['Psychic']],
 519: ['Pidove', ['Normal', 'Flying']],
 520: ['Tranquill', ['Normal', 'Flying']],
 521: ['Unfezant', ['Normal', 'Flying']],
 522: ['Blitzle', ['Electric']],
 523: ['Zebstrika', ['Electric']],
 524: ['Roggenrola', ['Rock']],
 525: ['Boldore', ['Rock']],
 526: ['Gigalith', ['Rock']],
 527: ['Woobat', ['Psychic', 'Flying']],
 528: ['Swoobat', ['Psychic', 'Flying']],
 529: ['Drilbur', ['Ground']],
 530: ['Excadrill', ['Ground', 'Steel']],
 531: ['Audino', ['Normal']],
 532: ['Timburr', ['Fighting']],
 533: ['Gurdurr', ['Fighting']],
 534: ['Conkeldurr', ['Fighting']],
 535: ['Tympole', ['Water']],
 536: ['Palpitoad', ['Water', 'Ground']],
 537: ['Seismitoad', ['Water', 'Ground']],
 538: ['Throh', ['Fighting']],
 539: ['Sawk', ['Fighting']],
 540: ['Sewaddle', ['Bug', 'Grass']],
 541: ['Swadloon', ['Bug', 'Grass']],
 542: ['Leavanny', ['Bug', 'Grass']],
 543: ['Venipede', ['Bug', 'Poison']],
 544: ['Whirlipede', ['Bug', 'Poison']],
 545: ['Scolipede', ['Bug', 'Poison']],
 546: ['Cottonee', ['Grass', 'Fairy']],
 547: ['Whimsicott', ['Grass', 'Fairy']],
 548: ['Petilil', ['Grass']],
 549: ['Lilligant', ['Grass']],
 550: ['Basculin', ['Water']],
 551: ['Sandile', ['Ground', 'Dark']],
 552: ['Krokorok', ['Ground', 'Dark']],
 553: ['Krookodile', ['Ground', 'Dark']],
 554: ['Darumaka', ['Fire']],
 555: ['Darmanitan', ['Fire']],
 556: ['Maractus', ['Grass']],
 557: ['Dwebble', ['Bug', 'Rock']],
 558: ['Crustle', ['Bug', 'Rock']],
 559: ['Scraggy', ['Dark', 'Fighting']],
 560: ['Scrafty', ['Dark', 'Fighting']],
 561: ['Sigilyph', ['Psychic', 'Flying']],
 562: ['Yamask', ['Ghost']],
 563: ['Cofagrigus', ['Ghost']],
 564: ['Tirtouga', ['Water', 'Rock']],
 565: ['Carracosta', ['Water', 'Rock']],
 566: ['Archen', ['Rock', 'Flying']],
 567: ['Archeops', ['Rock', 'Flying']],
 568: ['Trubbish', ['Poison']],
 569: ['Garbodor', ['Poison']],
 570: ['Zorua', ['Dark']],
 571: ['Zoroark', ['Dark']],
 572: ['Minccino', ['Normal']],
 573: ['Cinccino', ['Normal']],
 574: ['Gothita', ['Psychic']],
 575: ['Gothorita', ['Psychic']],
 576: ['Gothitelle', ['Psychic']],
 577: ['Solosis', ['Psychic']],
 578: ['Duosion', ['Psychic']],
 579: ['Reuniclus', ['Psychic']],
 580: ['Ducklett', ['Water', 'Flying']],
 581: ['Swanna', ['Water', 'Flying']],
 582: ['Vanillite', ['Ice']],
 583: ['Vanillish', ['Ice']],
 584: ['Vanilluxe', ['Ice']],
 585: ['Deerling', ['Normal', 'Grass']],
 586: ['Sawsbuck', ['Normal', 'Grass']],
 587: ['Emolga', ['Electric', 'Flying']],
 588: ['Karrablast', ['Bug']],
 589: ['Escavalier', ['Bug', 'Steel']],
 590: ['Foongus', ['Grass', 'Poison']],
 591: ['Amoonguss', ['Grass', 'Poison']],
 592: ['Frillish', ['Water', 'Ghost']],
 593: ['Jellicent', ['Water', 'Ghost']],
 594: ['Alomomola', ['Water']],
 595: ['Joltik', ['Bug', 'Electric']],
 596: ['Galvantula', ['Bug', 'Electric']],
 597: ['Ferroseed', ['Grass', 'Steel']],
 598: ['Ferrothorn', ['Grass', 'Steel']],
 599: ['Klink', ['Steel']],
 600: ['Klang', ['Steel']],
 601: ['Klinklang', ['Steel']],
 602: ['Tynamo', ['Electric']],
 603: ['Eelektrik', ['Electric']],
 604: ['Eelektross', ['Electric']],
 605: ['Elgyem', ['Psychic']],
 606: ['Beheeyem', ['Psychic']],
 607: ['Litwick', ['Ghost', 'Fire']],
 608: ['Lampent', ['Ghost', 'Fire']],
 609: ['Chandelure', ['Ghost', 'Fire']],
 610: ['Axew', ['Dragon']],
 611: ['Fraxure', ['Dragon']],
 612: ['Haxorus', ['Dragon']],
 613: ['Cubchoo', ['Ice']],
 614: ['Beartic', ['Ice']],
 615: ['Cryogonal', ['Ice']],
 616: ['Shelmet', ['Bug']],
 617: ['Accelgor', ['Bug']],
 618: ['Stunfisk', ['Electric', 'Ground']],
 619: ['Mienfoo', ['Fighting']],
 620: ['Mienshao', ['Fighting']],
 621: ['Druddigon', ['Dragon']],
 622: ['Golett', ['Ground', 'Ghost']],
 623: ['Golurk', ['Ground', 'Ghost']],
 624: ['Pawniard', ['Dark', 'Steel']],
 625: ['Bisharp', ['Dark', 'Steel']],
 626: ['Bouffalant', ['Normal']],
 627: ['Rufflet', ['Normal', 'Flying']],
 628: ['Braviary', ['Normal', 'Flying']],
 629: ['Vullaby', ['Dark', 'Flying']],
 630: ['Mandibuzz', ['Dark', 'Flying']],
 631: ['Heatmor', ['Fire']],
 632: ['Durant', ['Bug', 'Steel']],
 633: ['Deino', ['Dark', 'Dragon']],
 634: ['Zweilous', ['Dark', 'Dragon']],
 635: ['Hydreigon', ['Dark', 'Dragon']],
 636: ['Larvesta', ['Bug', 'Fire']],
 637: ['Volcarona', ['Bug', 'Fire']],
 638: ['Cobalion', ['Steel', 'Fighting']],
 639: ['Terrakion', ['Rock', 'Fighting']],
 640: ['Virizion', ['Grass', 'Fighting']],
 641: ['Tornadus', ['Flying']],
 642: ['Thundurus', ['Electric', 'Flying']],
 643: ['Reshiram', ['Dragon', 'Fire']],
 644: ['Zekrom', ['Dragon', 'Electric']],
 645: ['Landorus', ['Ground', 'Flying']],
 646: ['Kyurem', ['Dragon', 'Ice']],
 647: ['Keldeo', ['Water', 'Fighting']],
 648: ['Meloetta', ['Normal', 'Psychic']],
 649: ['Genesect', ['Bug', 'Steel']],
 650: ['Chespin', ['Grass']],
 651: ['Quilladin', ['Grass']],
 652: ['Chesnaught', ['Grass', 'Fighting']],
 653: ['Fennekin', ['Fire']],
 654: ['Braixen', ['Fire']],
 655: ['Delphox', ['Fire', 'Psychic']],
 656: ['Froakie', ['Water']],
 657: ['Frogadier', ['Water']],
 658: ['Greninja', ['Water', 'Dark']],
 659: ['Bunnelby', ['Normal']],
 660: ['Diggersby', ['Normal', 'Ground']],
 661: ['Fletchling', ['Normal', 'Flying']],
 662: ['Fletchinder', ['Fire', 'Flying']],
 663: ['Talonflame', ['Fire', 'Flying']],
 664: ['Scatterbug', ['Bug']],
 665: ['Spewpa', ['Bug']],
 666: ['Vivillon', ['Bug', 'Flying']],
 667: ['Litleo', ['Fire', 'Normal']],
 668: ['Pyroar', ['Fire', 'Normal']],
 669: ['Flabébé', ['Fairy']],
 670: ['Floette', ['Fairy']],
 671: ['Florges', ['Fairy']],
 672: ['Skiddo', ['Grass']],
 673: ['Gogoat', ['Grass']],
 674: ['Pancham', ['Fighting']],
 675: ['Pangoro', ['Fighting', 'Dark']],
 676: ['Furfrou', ['Normal']],
 677: ['Espurr', ['Psychic']],
 678: ['Meowstic', ['Psychic']],
 679: ['Honedge', ['Steel', 'Ghost']],
 680: ['Doublade', ['Steel', 'Ghost']],
 681: ['Aegislash', ['Steel', 'Ghost']],
 682: ['Spritzee', ['Fairy']],
 683: ['Aromatisse', ['Fairy']],
 684: ['Swirlix', ['Fairy']],
 685: ['Slurpuff', ['Fairy']],
 686: ['Inkay', ['Dark', 'Psychic']],
 687: ['Malamar', ['Dark', 'Psychic']],
 688: ['Binacle', ['Rock', 'Water']],
 689: ['Barbaracle', ['Rock', 'Water']],
 690: ['Skrelp', ['Poison', 'Water']],
 691: ['Dragalge', ['Poison', 'Dragon']],
 692: ['Clauncher', ['Water']],
 693: ['Clawitzer', ['Water']],
 694: ['Helioptile', ['Electric', 'Normal']],
 695: ['Heliolisk', ['Electric', 'Normal']],
 696: ['Tyrunt', ['Rock', 'Dragon']],
 697: ['Tyrantrum', ['Rock', 'Dragon']],
 698: ['Amaura', ['Rock', 'Ice']],
 699: ['Aurorus', ['Rock', 'Ice']],
 700: ['Sylveon', ['Fairy']],
 701: ['Hawlucha', ['Fighting', 'Flying']],
 702: ['Dedenne', ['Electric', 'Fairy']],
 703: ['Carbink', ['Rock', 'Fairy']],
 704: ['Goomy', ['Dragon']],
 705: ['Sliggoo', ['Dragon']],
 706: ['Goodra', ['Dragon']],
 707: ['Klefki', ['Steel', 'Fairy']],
 708: ['Phantump', ['Ghost', 'Grass']],
 709: ['Trevenant', ['Ghost', 'Grass']],
 710: ['Pumpkaboo', ['Ghost', 'Grass']],
 711: ['Gourgeist', ['Ghost', 'Grass']],
 712: ['Bergmite', ['Ice']],
 713: ['Avalugg', ['Ice']],
 714: ['Noibat', ['Flying', 'Dragon']],
 715: ['Noivern', ['Flying', 'Dragon']],
 716: ['Xerneas', ['Fairy']],
 717: ['Yveltal', ['Dark', 'Flying']],
 718: ['Zygarde', ['Dragon', 'Ground']]}