080502 - Pokémon Illustration Book

題目敘述 Problems Description:

傑森是個寶可夢迷,他的夢想是當個寶可夢大師,但是他的寶可夢圖鑑卻少了幾個世代,請你幫他利用爬蟲到寶可夢官方網站抓取他缺的寶可夢圖片。

Jason is a Pokémon fan. His dream is to be a Pokémon master, but his Pokémon illustration book missed a few generations. Please help him to get all of the pictures by crawler on the Pokémon official website, which is missed in his book.

輸入說明 Input Description:

請使用下面的網址抓取第1、5、7世代的所有圖片。

Please use the following link to get all of the pictures in generation 1, 5, 7.

<<< Pokémon info >>>

輸出說明 Output Description:

請將每個圖片抓下來並存到對應世代名稱的資料夾中,而圖片名稱須為ID_名稱_屬性.png。另外,若有多個屬性,請依序利用_來區隔。若有除了.以外的奇怪符號,像是:\等,請直接刪掉。

Please download each picture into the folder which name is the corresponding generation no. and the picture name format must be ID Number_Name_Attribute.png. Besides, please use _ to separate each attribute if there are multiple attributes. If there are some weird symbols in its name except ., like :,\, etc, please remove it.

輸入範例 Input Example:

None

輸出範例 Output Example:

Picture name: 1_Bulbasaur_grass_poison.png

提示 Hint:

請自行檢查當下路徑是否有Pokemons的資料夾,並且裡面有Generation_1Generation_5Generation_7的資料夾,若沒有則新增。此外,請根據下圖的結構來建資料夾與存放檔案。

Please check whether there is a folder of Pokemons in the current path, and there are folders of Generation_1, Generation_5, and Generation_7 in it. If not, add them. In addition, please create folders and save files according to the structure shown in the figure below.

請使用 beautifulsoup library 搭配 lxml 來爬資料。 Please use beautifulsoup library and lxml to do web scraping

最后更新于

这有帮助吗?