├── 3_team ├── examples │ ├── .gitignore │ ├── syntax.rst │ ├── index.rst │ ├── Makefile │ ├── make.bat │ └── conf.py ├── tests │ ├── sample.py │ ├── invalid_sample.py │ ├── unittest_sample_ng │ │ ├── sample.py │ │ └── tests.py │ ├── unittest_sample_ok │ │ ├── sample.py │ │ └── tests.py │ ├── sample_doctest_ng.py │ └── sample_doctest_ok.py └── README.md ├── 6_web ├── brickset_app │ ├── item │ │ ├── __init__.py │ │ ├── management │ │ │ ├── __init__.py │ │ │ └── commands │ │ │ │ ├── __init__.py │ │ │ │ └── import_item.py │ │ ├── migrations │ │ │ ├── __init__.py │ │ │ └── 0001_initial.py │ │ ├── tests.py │ │ ├── apps.py │ │ ├── admin.py │ │ ├── forms.py │ │ ├── templates │ │ │ ├── item │ │ │ │ ├── edit.html │ │ │ │ └── list.html │ │ │ ├── accounts │ │ │ │ └── login.html │ │ │ ├── wish_list │ │ │ │ └── list.html │ │ │ └── base.html │ │ ├── urls.py │ │ ├── models.py │ │ └── views.py │ ├── brickset_app │ │ ├── __init__.py │ │ ├── wsgi.py │ │ ├── urls.py │ │ └── settings.py │ └── manage.py ├── requirements.txt └── README.md ├── 2_guide ├── memo.txt ├── todo.txt ├── photo.png ├── calc.py ├── fizzbuzz.py ├── README.md ├── 2_1.ipynb ├── 2_4.ipynb ├── 2_2.ipynb └── 2_3.ipynb ├── 4_scraping ├── lego_scraper │ ├── lego_scraper │ │ ├── __init__.py │ │ ├── spiders │ │ │ ├── __init__.py │ │ │ ├── brickset1.py │ │ │ ├── brickset0.py │ │ │ ├── brickset2.py │ │ │ ├── brickset3.py │ │ │ ├── brickset4.py │ │ │ ├── brickset5.py │ │ │ ├── brickset6.py │ │ │ └── brickset.py │ │ ├── pipelines.py │ │ ├── items.py │ │ ├── middlewares.py │ │ └── settings.py │ ├── scrapy.cfg │ └── brickset2017.csv ├── requirements.txt ├── requests-sample.py ├── requests-json.py ├── bs4-sample.py ├── README.md └── 4_2_scraping.ipynb ├── cover.jpg ├── column ├── sample.jpg ├── requirements.txt ├── README.md └── column.ipynb ├── 5_pydata └── README.md ├── LICENSE ├── README.md └── .gitignore /3_team/examples/.gitignore: -------------------------------------------------------------------------------- 1 | _build -------------------------------------------------------------------------------- /6_web/brickset_app/item/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /6_web/brickset_app/brickset_app/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /6_web/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==1.11.3 2 | -------------------------------------------------------------------------------- /2_guide/memo.txt: -------------------------------------------------------------------------------- 1 | 今日はラーメンが食べたい 2 | 夕飯は何にしよう 3 | -------------------------------------------------------------------------------- /2_guide/todo.txt: -------------------------------------------------------------------------------- 1 | 本を書く 2 | 新しいPythonライブラリーを試す 3 | -------------------------------------------------------------------------------- /4_scraping/lego_scraper/lego_scraper/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /6_web/brickset_app/item/management/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /6_web/brickset_app/item/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /3_team/tests/sample.py: -------------------------------------------------------------------------------- 1 | def run(): 2 | return 'OK' 3 | -------------------------------------------------------------------------------- /6_web/brickset_app/item/management/commands/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pyfirst/samplecode/HEAD/cover.jpg -------------------------------------------------------------------------------- /2_guide/photo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pyfirst/samplecode/HEAD/2_guide/photo.png -------------------------------------------------------------------------------- /column/sample.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pyfirst/samplecode/HEAD/column/sample.jpg -------------------------------------------------------------------------------- /3_team/tests/invalid_sample.py: -------------------------------------------------------------------------------- 1 | def run(): 2 | unused_variable = '' 3 | return 'OK' 4 | -------------------------------------------------------------------------------- /2_guide/calc.py: -------------------------------------------------------------------------------- 1 | def add(a, b): 2 | return a + b 3 | 4 | 5 | def sub(a, b): 6 | return a - b 7 | -------------------------------------------------------------------------------- /3_team/tests/unittest_sample_ng/sample.py: -------------------------------------------------------------------------------- 1 | def add(m, n): 2 | """mとnを加算して返す""" 3 | return m - n 4 | -------------------------------------------------------------------------------- /3_team/tests/unittest_sample_ok/sample.py: -------------------------------------------------------------------------------- 1 | def add(m, n): 2 | """mとnを加算して返す""" 3 | return m + n 4 | -------------------------------------------------------------------------------- /6_web/brickset_app/item/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /4_scraping/requirements.txt: -------------------------------------------------------------------------------- 1 | beautifulsoup4==4.6.0 2 | requests==2.18.3 3 | Scrapy==1.4.0 4 | jupyter==1.0.0 5 | -------------------------------------------------------------------------------- /6_web/brickset_app/item/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ItemConfig(AppConfig): 5 | name = 'item' 6 | -------------------------------------------------------------------------------- /3_team/tests/sample_doctest_ng.py: -------------------------------------------------------------------------------- 1 | def get_ok(): 2 | """ 3 | 文字列 'OK' を返す 4 | 5 | >>> get_ok() 6 | 'OK' 7 | """ 8 | return 'NG' 9 | -------------------------------------------------------------------------------- /3_team/tests/sample_doctest_ok.py: -------------------------------------------------------------------------------- 1 | def get_ok(): 2 | """ 3 | 文字列 'OK' を返す 4 | 5 | >>> get_ok() 6 | 'OK' 7 | """ 8 | return 'OK' 9 | -------------------------------------------------------------------------------- /6_web/brickset_app/item/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | from .models import Item, WishList 4 | 5 | admin.site.register(Item) 6 | admin.site.register(WishList) 7 | -------------------------------------------------------------------------------- /4_scraping/requests-sample.py: -------------------------------------------------------------------------------- 1 | # Requestsでgihyo.jpのページのデータを取得 2 | 3 | import requests 4 | 5 | r = requests.get('http://gihyo.jp') 6 | print(r.status_code) # ステータスコードを取得 7 | print(r.text[:50]) # 先頭50文字を取得 8 | -------------------------------------------------------------------------------- /3_team/tests/unittest_sample_ng/tests.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | class Test(unittest.TestCase): 4 | def test_it(self): 5 | import sample 6 | value = sample.add(1, 1) 7 | self.assertEqual(2, value) 8 | -------------------------------------------------------------------------------- /3_team/tests/unittest_sample_ok/tests.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | class Test(unittest.TestCase): 4 | def test_it(self): 5 | import sample 6 | value = sample.add(1, 1) 7 | self.assertEqual(2, value) 8 | -------------------------------------------------------------------------------- /4_scraping/lego_scraper/lego_scraper/spiders/__init__.py: -------------------------------------------------------------------------------- 1 | # This package will contain the spiders of your Scrapy project 2 | # 3 | # Please refer to the documentation for information on how to create and manage 4 | # your spiders. 5 | -------------------------------------------------------------------------------- /column/requirements.txt: -------------------------------------------------------------------------------- 1 | beautifulsoup4==4.6.0 2 | certifi==2017.7.27.1 3 | chardet==3.0.4 4 | idna==2.5 5 | olefile==0.44 6 | Pillow==4.2.1 7 | python-dateutil==2.6.1 8 | requests==2.18.3 9 | six==1.10.0 10 | urllib3==1.22 11 | -------------------------------------------------------------------------------- /5_pydata/README.md: -------------------------------------------------------------------------------- 1 | # 第5章 PyData 入門ガイド - サンプルコード 2 | 3 | - [sample-code-5.3-5.4.ipynb](./sample-code-5.3-5.4.ipynb) 4 | 5 | 「5.3 実践 レゴデータ分析[データ探索編]」および 「5.4 実践 レゴデータ分析[データ可視化、分析編]」の 6 | サンプルコードです。重要なコードのみ抜粋し、コード中のコメントは省略しています。詳しい解説は書籍をご確認ください。 7 | -------------------------------------------------------------------------------- /4_scraping/requests-json.py: -------------------------------------------------------------------------------- 1 | # JSON形式のAPIレスポンスを取得 2 | 3 | import requests 4 | 5 | r = requests.get('https://connpass.com/api/v1/event/?keyword=python') 6 | data = r.json() # JSONをデコードしたデータを取得 7 | for event in data['events']: 8 | print(event['title']) 9 | -------------------------------------------------------------------------------- /column/README.md: -------------------------------------------------------------------------------- 1 | # コラム 便利な標準ライブラリ,サードパーティ製パッケージ 2 | 3 | 「コラム 便利な標準ライブラリ,サードパーティ製パッケージ」のサンプルコードです。 4 | 5 | 以下のファイルがあります。 6 | 7 | * requirements.txt: サンプルコードで使用するライブラリをインストトールするためのファイル 8 | * column.ipynb: サンプルコードをまとめた Jupyter Notebook ファイル 9 | * sample.jpg: サンプルの画像ファイル -------------------------------------------------------------------------------- /3_team/README.md: -------------------------------------------------------------------------------- 1 | # 3章 開発環境とチーム開発 2 | 3 | 3章のサンプルコードです。 4 | 5 | - ./examples 6 | 7 | 「3.5 Sphinx」のサンプルプロジェクトです。 8 | `cd examples` でディレクトリを移動してお使いください。 9 | 10 | - ./tests 11 | 12 | 「3.4 テストと品質」のサンプルプログラムとテストコードです。 13 | `cd tests` でディレクトリを移動してお使いください。 14 | -------------------------------------------------------------------------------- /2_guide/fizzbuzz.py: -------------------------------------------------------------------------------- 1 | def fizzbuzz(num): 2 | if num % 3 == 0 and num % 5 == 0: 3 | return 'FizzBuzz' 4 | elif num % 3 == 0: 5 | return 'Fizz' 6 | elif num % 5 == 0: 7 | return 'Buzz' 8 | else: 9 | return str(num) 10 | 11 | 12 | for num in range(1, 101): 13 | print(fizzbuzz(num)) 14 | -------------------------------------------------------------------------------- /4_scraping/lego_scraper/scrapy.cfg: -------------------------------------------------------------------------------- 1 | # Automatically created by: scrapy startproject 2 | # 3 | # For more information about the [deploy] section see: 4 | # https://scrapyd.readthedocs.org/en/latest/deploy.html 5 | 6 | [settings] 7 | default = lego_scraper.settings 8 | 9 | [deploy] 10 | #url = http://localhost:6800/ 11 | project = lego_scraper 12 | -------------------------------------------------------------------------------- /6_web/brickset_app/item/forms.py: -------------------------------------------------------------------------------- 1 | from django.forms import ModelForm 2 | 3 | from .models import Item 4 | 5 | 6 | class ItemForm(ModelForm): 7 | class Meta: 8 | model = Item 9 | fields = [ 10 | 'name', 'image_url', 'rating', 'piece_count', 11 | 'minifig_count', 'us_price', 'owner_count', 'want_it_count' 12 | ] 13 | -------------------------------------------------------------------------------- /3_team/examples/syntax.rst: -------------------------------------------------------------------------------- 1 | ============== 2 | ページタイトル 3 | ============== 4 | 5 | 見出し1 6 | ======= 7 | 8 | 番号付きリスト 9 | -------------- 10 | 11 | #. 1番目 12 | #. 2番目 13 | #. 3番目 14 | 15 | 番号なしリスト 16 | -------------- 17 | 18 | - 番号なしリスト 19 | - 番号なしリスト 20 | - 番号なしリスト 21 | 22 | ハイパーリンク 23 | -------------- 24 | 25 | - http://python.org 26 | - `PyPI ` 27 | -------------------------------------------------------------------------------- /4_scraping/lego_scraper/lego_scraper/pipelines.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Define your item pipelines here 4 | # 5 | # Don't forget to add your pipeline to the ITEM_PIPELINES setting 6 | # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html 7 | 8 | 9 | class LegoScraperPipeline(object): 10 | def process_item(self, item, spider): 11 | return item 12 | -------------------------------------------------------------------------------- /4_scraping/lego_scraper/lego_scraper/items.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Define here the models for your scraped items 4 | # 5 | # See documentation in: 6 | # http://doc.scrapy.org/en/latest/topics/items.html 7 | 8 | import scrapy 9 | 10 | 11 | class LegoScraperItem(scrapy.Item): 12 | # define the fields for your item here like: 13 | # name = scrapy.Field() 14 | pass 15 | -------------------------------------------------------------------------------- /4_scraping/lego_scraper/lego_scraper/spiders/brickset1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | ''' 3 | リスト4.6 4 | start_urlsを書き換えたもの 5 | ''' 6 | 7 | import scrapy 8 | 9 | 10 | class BricksetSpider(scrapy.Spider): 11 | name = "brickset1" 12 | allowed_domains = ["brickset.com"] 13 | start_urls = ['https://brickset.com/sets/year-2016'] 14 | 15 | def parse(self, response): 16 | pass 17 | -------------------------------------------------------------------------------- /4_scraping/lego_scraper/lego_scraper/spiders/brickset0.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | ''' 3 | リスト4.5 4 | scrapy genspider brickset brickset.com で作成した直後のファイル 5 | ''' 6 | 7 | import scrapy 8 | 9 | 10 | class BricksetSpider(scrapy.Spider): 11 | name = "brickset0" 12 | allowed_domains = ["brickset.com"] 13 | start_urls = ['http://brickset.com/'] 14 | 15 | def parse(self, response): 16 | pass 17 | -------------------------------------------------------------------------------- /6_web/brickset_app/brickset_app/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for brickset_app project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "brickset_app.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /4_scraping/lego_scraper/lego_scraper/spiders/brickset2.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | ''' 3 | リスト4.8 4 | セット名称を取り出す 5 | ''' 6 | 7 | import scrapy 8 | 9 | 10 | class BricksetSpider(scrapy.Spider): 11 | name = "brickset2" 12 | allowed_domains = ["brickset.com"] 13 | start_urls = ['https://brickset.com/sets/year-2016'] 14 | 15 | def parse(self, response): 16 | for brickset in response.css('article.set'): 17 | print(brickset.css('div.highslide-caption h1::text').extract_first()) 18 | -------------------------------------------------------------------------------- /3_team/examples/index.rst: -------------------------------------------------------------------------------- 1 | .. example documentation master file, created by 2 | sphinx-quickstart on Tue Aug 8 22:29:57 2017. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to example's documentation! 7 | =================================== 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | :caption: Contents: 12 | 13 | 14 | 15 | Indices and tables 16 | ================== 17 | 18 | * :ref:`genindex` 19 | * :ref:`modindex` 20 | * :ref:`search` 21 | -------------------------------------------------------------------------------- /2_guide/README.md: -------------------------------------------------------------------------------- 1 | # 第2章 Pythonはじめの一歩 2 | 3 | 第2章 Pythonはじめの一歩のサンプルコードです。 4 | 5 | * `2_1.ipynb`: 2-1のコードを書いたJupyterNotebook 6 | * `2_2.ipynb`: 2-2のコードを書いたJupyterNotebook 7 | * `2_3.ipynb`: 2-3のコードを書いたJupyterNotebook 8 | * `2_4.ipynb`: 2-3のコードを書いたJupyterNotebook 9 | * `fizzbuzz.py`: FizzbuzzプログラムのPythonファイル 10 | * `calc.py`: `import` 文を試すためPythonファイル 11 | 12 | 他、テキストファイルや画像ファイルなど、プログラム中に必要なファイルが入っています。 13 | 14 | ## 実行方法 15 | 16 | JupyterNotebookを起動し、各節のJupyterNotebookを開いて実行できます。 17 | `fizzbuzz.py` はターミナルなどから `python fizzbuzz.py` と実行します 18 | (詳しくは書籍内を参考にしてください)。 19 | -------------------------------------------------------------------------------- /6_web/brickset_app/item/templates/item/edit.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block contents %} 4 | 5 |
6 | 7 | 8 |
9 | 10 |
11 | {% csrf_token %} 12 | {{ form.as_p }} 13 | 14 |
15 |
16 |
17 | 18 | {% endblock %} -------------------------------------------------------------------------------- /6_web/brickset_app/item/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | 3 | from . import views 4 | 5 | # ルーティングの設定 6 | urlpatterns = [ 7 | 8 | # item 9 | url(r'^$', views.index, name='item_index'), 10 | url(r'^(?P[0-9]+)/edit/$', views.edit, name='item_edit'), 11 | url(r'^(?P[0-9]+)/delete/$', views.delete, name='item_delete'), 12 | url(r'^(?P[0-9]+)/add/wish_list/$', views.add_to_wish_list, name='item_add_wish_list'), 13 | url(r'^(?P[0-9]+)/delete/wish_list/$', views.delete_from_wish_list, name='item_delete_wish_list'), 14 | 15 | # wish_list 16 | url(r'^wish_list/$', views.wish_list_index, name='wish_list_index'), 17 | 18 | ] 19 | -------------------------------------------------------------------------------- /3_team/examples/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = python -msphinx 7 | SPHINXPROJ = example 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /4_scraping/lego_scraper/lego_scraper/spiders/brickset3.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | ''' 3 | リスト4.9 4 | セット番号を取り出す 5 | ''' 6 | 7 | import scrapy 8 | 9 | 10 | class BricksetSpider(scrapy.Spider): 11 | name = "brickset3" 12 | allowed_domains = ["brickset.com"] 13 | start_urls = ['https://brickset.com/sets/year-2016'] 14 | 15 | def parse(self, response): 16 | for brickset in response.css('article.set'): 17 | meta = brickset.css('div.meta') 18 | # セット番号を取得 19 | number = meta.css('h1 span::text').re_first(r'(.+): ') 20 | # セット名を取得 21 | name = brickset.css('div.highslide-caption h1::text').extract_first() 22 | print(number, name) 23 | 24 | -------------------------------------------------------------------------------- /6_web/brickset_app/item/templates/accounts/login.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block contents %} 4 | 5 |
6 |

ログイン

7 | 8 | 9 |
10 | 11 |
12 |
13 | {% csrf_token %} 14 | {{ form.as_p }} 15 | 16 |
17 | 18 |
19 |
20 | 21 | {% endblock %} -------------------------------------------------------------------------------- /4_scraping/bs4-sample.py: -------------------------------------------------------------------------------- 1 | # Beautiful Soup 4で「技評ねこ部通信」を取得 2 | 3 | import requests 4 | from bs4 import BeautifulSoup 5 | 6 | r = requests.get('http://gihyo.jp/lifestyle/clip/01/everyday-cat') 7 | soup = BeautifulSoup(r.content, 'html.parser') 8 | title = soup.title # titleタグの情報を取得 9 | 10 | print(type(title)) # オブジェクトの型は Tag 型 11 | # 12 | 13 | print(title) # タイトルの中身を確認 14 | # 技評ねこ部通信|gihyo.jp … 技術評論社 15 | 16 | print(title.text) # タイトルの中のテキストを取得 17 | # 技評ねこ部通信|gihyo.jp … 技術評論社 18 | 19 | div = soup.find('div', class_='readingContent01') 20 | for li in div.find_all('li'): # divタグの中の全liタグを取得 21 | url = li.a['href'] 22 | date, text = li.a.text.split() 23 | print('{},{},{}'.format(date, text, url)) 24 | -------------------------------------------------------------------------------- /6_web/README.md: -------------------------------------------------------------------------------- 1 | # 概要 2 | 3 | このソースコードは、[Pythonエンジニア ファーストブック](http://gihyo.jp/book/2017/978-4-7741-9222-2)の第6章(Webアプリケーション開発)のレゴ管理アプリケーションのサンプルソースです。ぜひこ活用ください。 4 | 5 | ## レゴ管理アプリケーション 6 | 7 | アプリケーションは以下の手順を行うと動作を確認できます。 8 | 9 | ``` 10 | $ git clone git@github.com:pyfirst/samplecode.git 11 | $ cd samplecode/6_web/ 12 | $ python3 -m venv env # 仮想環境を作成 13 | $ . env/bin/activate # 仮想環境を有効化 14 | (env) $ pip install -r requirements.txt # Djangoのインストール 15 | (env) $ cd brickset_app/ アプリケーションのディレクトリに移動 16 | (env) $ python manage.py migrate # DBのマイグレーションを実行 17 | (env) $ python manage.py import_item # DBへマスターデータを挿入 18 | (env) $ python manage.py createsuperuser # 管理者ユーザーの作成 19 | (env) $ python manage.py runserver # 開発サーバーの起動 20 | ``` 21 | 22 | 開発サーバーを起動したら、http://127.0.0.1:8000/item/ にアクセスしてください。 23 | -------------------------------------------------------------------------------- /4_scraping/lego_scraper/lego_scraper/spiders/brickset4.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | ''' 3 | リスト4.10 4 | yieldキーワードで取得した情報を返す 5 | ''' 6 | 7 | import scrapy 8 | 9 | 10 | class BricksetSpider(scrapy.Spider): 11 | name = "brickset4" 12 | allowed_domains = ["brickset.com"] 13 | start_urls = ['https://brickset.com/sets/year-2016'] 14 | 15 | def parse(self, response): 16 | for brickset in response.css('article.set'): 17 | meta = brickset.css('div.meta') 18 | # セット番号を取得 19 | number = meta.css('h1 span::text').re_first(r'(.+): ') 20 | # セット名を取得 21 | name = brickset.css('div.highslide-caption h1::text').extract_first() 22 | yield { 23 | 'number': number, 24 | 'name': name, 25 | } 26 | 27 | 28 | -------------------------------------------------------------------------------- /6_web/brickset_app/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "brickset_app.settings") 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError: 10 | # The above import may fail for some other reason. Ensure that the 11 | # issue is really that Django is missing to avoid masking other 12 | # exceptions on Python 2. 13 | try: 14 | import django 15 | except ImportError: 16 | raise ImportError( 17 | "Couldn't import Django. Are you sure it's installed and " 18 | "available on your PYTHONPATH environment variable? Did you " 19 | "forget to activate a virtual environment?" 20 | ) 21 | raise 22 | execute_from_command_line(sys.argv) -------------------------------------------------------------------------------- /3_team/examples/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=python -msphinx 9 | ) 10 | set SOURCEDIR=. 11 | set BUILDDIR=_build 12 | set SPHINXPROJ=example 13 | 14 | if "%1" == "" goto help 15 | 16 | %SPHINXBUILD% >NUL 2>NUL 17 | if errorlevel 9009 ( 18 | echo. 19 | echo.The Sphinx module was not found. Make sure you have Sphinx installed, 20 | echo.then set the SPHINXBUILD environment variable to point to the full 21 | echo.path of the 'sphinx-build' executable. Alternatively you may add the 22 | echo.Sphinx directory to PATH. 23 | echo. 24 | echo.If you don't have Sphinx installed, grab it from 25 | echo.http://sphinx-doc.org/ 26 | exit /b 1 27 | ) 28 | 29 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 30 | goto end 31 | 32 | :help 33 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 34 | 35 | :end 36 | popd 37 | -------------------------------------------------------------------------------- /4_scraping/lego_scraper/lego_scraper/spiders/brickset5.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | ''' 3 | リスト4.13 4 | 次のページを取得する 5 | ''' 6 | 7 | import scrapy 8 | 9 | 10 | class BricksetSpider(scrapy.Spider): 11 | name = "brickset5" 12 | allowed_domains = ["brickset.com"] 13 | start_urls = ['https://brickset.com/sets/year-2016'] 14 | 15 | def parse(self, response): 16 | for brickset in response.css('article.set'): 17 | meta = brickset.css('div.meta') 18 | # セット番号を取得 19 | number = meta.css('h1 span::text').re_first(r'(.+): ') 20 | # セット名を取得 21 | name = brickset.css('div.highslide-caption h1::text').extract_first() 22 | yield { 23 | 'number': number, 24 | 'name': name, 25 | } 26 | # 次のページを取得する 27 | next_url = response.css('li.next a::attr(href)').extract_first() 28 | if next_url: 29 | yield scrapy.Request(next_url) 30 | 31 | -------------------------------------------------------------------------------- /4_scraping/README.md: -------------------------------------------------------------------------------- 1 | # 第4章 スクレイピング 2 | 3 | 「第4章 スクレイピング」のサンプルコードです。 4 | 5 | 以下のフォルダ、ファイルがあります。 6 | 7 | * lego_scraper/: LEGOデータをスクレイピングするコードが入ったフォルダ 8 | * 4_2_scraping.ipynb: 「4.2 サードパーティ製パッケージを使ってスクレイピングに挑戦」のコードを記述した Jupyter Notebook 9 | * bs4-sample.py: Beautiful Soup 4で「技評ねこ部通信」を取得するコード 10 | * requests-json.py: RequestsでJSONを取得するコード 11 | * requests-sample.py: Requestsのコード 12 | * requirements.txt: 4章で使用するライブラリをインストールするための requirements.txt 13 | 14 | ## lego_scraper について 15 | 16 | `lego_scraper/lego_scraper/spiders` の下に、各手順での Spider のコードが入っています。 17 | 書籍の対応する場所は、コード中に `リスト4.5` のように記述してあります。 18 | 19 | 以下の手順で Spider が手元で実行できます。 20 | 21 | ``` 22 | $ git clone git@github.com:pyfirst/samplecode.git 23 | $ cd samplecode/4_scraping/lego_scraper 24 | $ python3 -m venv env # 仮想環境を作成 25 | $ . env/bin/activate # 仮想環境を有効化 26 | (env) $ pip install scrapy # scarpy をインストール 27 | (env) $ scrapy crawl brickset0.py # 最初の手順の Spider を実行 28 | (env) $ scrapy crawl brickset1.py 29 | : 30 | (env) $ scrapy crawl brickset.py # 完成形の Spider を実行 31 | ``` -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Takanori Suzuki 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /6_web/brickset_app/item/models.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth.models import User 2 | from django.db import models 3 | 4 | 5 | class Item(models.Model): 6 | set_number = models.IntegerField('セット番号') 7 | name = models.CharField('名前', max_length=255) 8 | image_url = models.URLField('画像URL', blank=True) 9 | rating = models.FloatField('レーティング', default=0.0) 10 | piece_count = models.IntegerField('ピース数', default=0) 11 | minifig_count = models.IntegerField('ミニフィグ数', default=0) 12 | us_price = models.FloatField('US価格', default=0.0) 13 | owner_count = models.IntegerField('オーナー数', default=0) 14 | want_it_count = models.IntegerField('欲しい数', default=0) 15 | created_at = models.DateTimeField('作成日時', auto_now_add=True) 16 | updated_at = models.DateTimeField('更新日時', auto_now=True) 17 | 18 | def __str__(self): 19 | return self.name 20 | 21 | 22 | class WishList(models.Model): 23 | user = models.OneToOneField(User) 24 | items = models.ManyToManyField(Item) 25 | created_at = models.DateTimeField('作成日時', auto_now_add=True) 26 | updated_at = models.DateTimeField('更新日時', auto_now=True) 27 | 28 | def __str__(self): 29 | return 'wish list - {}'.format(self.user.username) 30 | -------------------------------------------------------------------------------- /6_web/brickset_app/brickset_app/urls.py: -------------------------------------------------------------------------------- 1 | """brickset_app URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.11/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.conf.urls import url, include 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import include, url 17 | from django.contrib import admin 18 | 19 | from django.contrib.auth.views import login, logout 20 | 21 | urlpatterns = [ 22 | 23 | # ログイン 24 | url(r'^accounts/login/$', login, {'template_name': 'accounts/login.html'}, name='login'), 25 | url(r'^accounts/logout/$', logout, {'next_page': '/accounts/login/'}, name='logout'), 26 | 27 | # item 28 | url(r'^item/', include('item.urls')), 29 | 30 | # 管理サイト 31 | url(r'^admin/', admin.site.urls), 32 | ] 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pythonエンジニア ファーストブックのサンプルコード 2 | 3 | [Pythonエンジニア ファーストブック](http://gihyo.jp/book/2017/978-4-7741-9222-2 "Pythonエンジニア ファーストブック:書籍案内|技術評論社") 4 | 5 | Pythonエンジニア ファーストブック 6 | 7 | * 2017年9月9日発売 8 | * 鈴木たかのり,清原弘貴,嶋田健志,池内孝啓,関根裕紀 著 9 | * A5判/328ページ 10 | * 定価(本体2,400円+税) 11 | * ISBN 978-4-7741-9222-2 12 | 13 | ## 目次 14 | 15 | * 第1章 Pythonの動向 16 | * 1.1 Pythonの特徴 17 | * 1.2 Pythonの歴史 18 | * 1.3 Pythonのコミュニティ 19 | * 第2章 最低限知っておきたいPython言語の基本 20 | * 2.1 Pythonをはじめよう 21 | * 2.2 Pythonのデータ型[基本編] 22 | * 2.3 Pythonのデータ型[コレクション編] 23 | * 2.4 ファイル操作とモジュール 24 | * コラム 便利な標準ライブラリ,サードパーティ製パッケージ 25 | * 第3章 開発環境とチーム開発 26 | * 3.1 開発環境とチーム開発のポイント 27 | * 3.2 GitとGitHub 28 | * 3.3 venv 29 | * 3.4 テストと品質 30 | * 3.5 Sphinx 31 | * 3.6 PyCharm 32 | * 第4章 スクレイピング 33 | * 4.1 スクレイピングとは 34 | * 4.2 サードパーティ製パッケージを使ってスクレイピングに挑戦 35 | * 4.3 スクレイピングフレームワークScrapy入門 36 | * 第5章 PyData入門ガイド 37 | * 5.1 PyDataとは 38 | * 5.2 はじめてのJupyter Notebook 39 | * 5.3 実践 レゴデータ分析[データ探索編] 40 | * 5.4 実践 レゴデータ分析[データ可視化,分析編] 41 | * 5.5 Anaconda環境の利用 42 | * 5.6 PyDataパッケージガイド 43 | * 第6章 Webアプリケーション開発 44 | * 6.1 Webフレームワーク入門 45 | * 6.2 Djangoアプリケーションの作成と初期設定 46 | * 6.3 ビュー,テンプレート,ルーティング 47 | * 6.4 モデル,管理サイト 48 | * 6.5 レゴ管理アプリケーションの作成 49 | * 次のステップ 50 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *,cover 46 | .hypothesis/ 47 | 48 | # Translations 49 | *.mo 50 | *.pot 51 | 52 | # Django stuff: 53 | *.log 54 | local_settings.py 55 | 56 | # Flask stuff: 57 | instance/ 58 | .webassets-cache 59 | 60 | # Scrapy stuff: 61 | .scrapy 62 | 63 | # Sphinx documentation 64 | docs/_build/ 65 | 66 | # PyBuilder 67 | target/ 68 | 69 | # IPython Notebook 70 | .ipynb_checkpoints 71 | 72 | # pyenv 73 | .python-version 74 | 75 | # celery beat schedule file 76 | celerybeat-schedule 77 | 78 | # dotenv 79 | .env 80 | 81 | # virtualenv 82 | venv/ 83 | ENV/ 84 | 85 | # Spyder project settings 86 | .spyderproject 87 | 88 | # Rope project settings 89 | .ropeproject 90 | -------------------------------------------------------------------------------- /4_scraping/lego_scraper/lego_scraper/spiders/brickset6.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | ''' 3 | リスト4.14 4 | 他のデータを取得する 5 | ''' 6 | 7 | import scrapy 8 | 9 | 10 | class BricksetSpider(scrapy.Spider): 11 | name = "brickset6" 12 | allowed_domains = ["brickset.com"] 13 | start_urls = ['https://brickset.com/sets/year-2016'] 14 | 15 | def parse(self, response): 16 | for brickset in response.css('article.set'): 17 | meta = brickset.css('div.meta') 18 | # セット番号を取得 19 | number = meta.css('h1 span::text').re_first(r'(.+): ') 20 | # セット名を取得 21 | name = brickset.css('div.highslide-caption h1::text').extract_first() 22 | yield { 23 | 'number': number, 24 | 'name': name, 25 | 'image': brickset.css('img::attr(src)').re_first('(.*)\?'), 26 | 'theme': meta.css('.tags a')[1].css('a::text').extract_first(), 27 | 'subtheme': meta.css('.tags a.subtheme::text').extract_first(), 28 | 'year': meta.css('a.year::text').extract_first(), 29 | 'rating': meta.css('.rating::attr(title)').extract_first(), 30 | 'owner': brickset.css('dl.admin dd').re_first('(\d+) own this set'), 31 | 'want_it': brickset.css('dl.admin dd').re_first('(\d+) want it'), 32 | } 33 | # 次のページを取得する 34 | next_url = response.css('li.next a::attr(href)').extract_first() 35 | if next_url: 36 | yield scrapy.Request(next_url) 37 | 38 | -------------------------------------------------------------------------------- /6_web/brickset_app/item/management/commands/import_item.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from django.core.management.base import BaseCommand 4 | 5 | from ...models import Item 6 | 7 | 8 | # BaseCommandを継承して作成 9 | class Command(BaseCommand): 10 | # python manage.py help import_itemで表示されるメッセージ 11 | help = 'Create Item from json file' 12 | 13 | def remove_null(self, value, default): 14 | if value is None: 15 | return default 16 | return value 17 | 18 | # コマンドが実行された際に呼ばれるメソッド 19 | def handle(self, *args, **options): 20 | 21 | # ファイルのオープン 22 | with open('web.json', 'r') as file: 23 | 24 | # JSONの読み込み 25 | data = json.load(file) 26 | count = 0 27 | 28 | # 取得したデータを1件づつ取り出す 29 | for item_obj in data: 30 | 31 | if not item_obj['number']: 32 | continue 33 | 34 | # Itemの保存処理 35 | item = Item() 36 | item.set_number = item_obj['number'] 37 | item.name = self.remove_null(item_obj['name'], '') 38 | item.image_url = self.remove_null(item_obj['image'], '') 39 | item.rate = self.remove_null(item_obj['rating'], 0.0) 40 | item.piece_count = self.remove_null(item_obj['pieces'], 0) 41 | item.minifig_count = self.remove_null(item_obj['minifigs'], 0) 42 | item.us_price = self.remove_null(item_obj['us_price'], 0.0) 43 | item.want_it_count = self.remove_null(item_obj['want_it'], 0) 44 | item.owner_count = self.remove_null(item_obj['owner'], 0) 45 | item.save() 46 | 47 | count += 1 48 | print('Create Item: {0}: {1}'.format(item.id, item.name)) 49 | 50 | print('{} items have been created.'.format(count)) 51 | -------------------------------------------------------------------------------- /6_web/brickset_app/item/templates/wish_list/list.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block contents %} 4 | 5 |
6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | {% for item in items %} 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 38 | 39 | {% endfor %} 40 | 41 |
セット番号画像名前ピース数ミニフィグ数US価格レーティング
{{ item.set_number }}{{ item.name }}{{ item.piece_count }}{{ item.minifig_count }}{{ item.us_price }}{{ item.rating }} 33 |
34 | {% csrf_token %} 35 |

36 |
37 |
42 |
43 |
44 | 45 | {% endblock %} 46 | 47 | -------------------------------------------------------------------------------- /4_scraping/lego_scraper/lego_scraper/spiders/brickset.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | ''' 3 | リスト4.17 4 | 完成形: XPathでピース数、ミニフィグ数、価格を取得する 5 | ''' 6 | 7 | import scrapy 8 | 9 | 10 | class BricksetSpider(scrapy.Spider): 11 | name = "brickset" 12 | allowed_domains = ["brickset.com"] 13 | start_urls = ['https://brickset.com/sets/year-2016'] 14 | 15 | def parse(self, response): 16 | for brickset in response.css('article.set'): 17 | meta = brickset.css('div.meta') 18 | # セット番号を取得 19 | number = meta.css('h1 span::text').re_first(r'(.+): ') 20 | # セット名を取得 21 | name = brickset.css('div.highslide-caption h1::text').extract_first() 22 | price = meta.xpath('.//dt[text()="RRP"]/following-sibling::dd/text()') 23 | yield { 24 | 'number': number, 25 | 'name': name, 26 | 'image': brickset.css('img::attr(src)').re_first('(.*)\?'), 27 | 'theme': meta.css('.tags a')[1].css('a::text').extract_first(), 28 | 'subtheme': meta.css('.tags a.subtheme::text').extract_first(), 29 | 'year': meta.css('a.year::text').extract_first(), 30 | 'rating': meta.css('.rating::attr(title)').extract_first(), 31 | 'pieces': meta.xpath('.//dt[text()="Pieces"]/following-sibling::dd').css('::text').extract_first(), 32 | 'minifigs': meta.xpath('.//dt[text()="Minifigs"]/following-sibling::dd').css('::text').extract_first(), 33 | 'us_price': price.re_first('\$(\d+\.\d+)'), 34 | 'eu_price': price.re_first('(\d+\.\d+)€'), 35 | 'owner': brickset.css('dl.admin dd').re_first('(\d+) own this set'), 36 | 'want_it': brickset.css('dl.admin dd').re_first('(\d+) want it'), 37 | } 38 | # 次のページを取得する 39 | next_url = response.css('li.next a::attr(href)').extract_first() 40 | if next_url: 41 | yield scrapy.Request(next_url) 42 | 43 | -------------------------------------------------------------------------------- /4_scraping/lego_scraper/lego_scraper/middlewares.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Define here the models for your spider middleware 4 | # 5 | # See documentation in: 6 | # http://doc.scrapy.org/en/latest/topics/spider-middleware.html 7 | 8 | from scrapy import signals 9 | 10 | 11 | class LegoScraperSpiderMiddleware(object): 12 | # Not all methods need to be defined. If a method is not defined, 13 | # scrapy acts as if the spider middleware does not modify the 14 | # passed objects. 15 | 16 | @classmethod 17 | def from_crawler(cls, crawler): 18 | # This method is used by Scrapy to create your spiders. 19 | s = cls() 20 | crawler.signals.connect(s.spider_opened, signal=signals.spider_opened) 21 | return s 22 | 23 | def process_spider_input(response, spider): 24 | # Called for each response that goes through the spider 25 | # middleware and into the spider. 26 | 27 | # Should return None or raise an exception. 28 | return None 29 | 30 | def process_spider_output(response, result, spider): 31 | # Called with the results returned from the Spider, after 32 | # it has processed the response. 33 | 34 | # Must return an iterable of Request, dict or Item objects. 35 | for i in result: 36 | yield i 37 | 38 | def process_spider_exception(response, exception, spider): 39 | # Called when a spider or process_spider_input() method 40 | # (from other spider middleware) raises an exception. 41 | 42 | # Should return either None or an iterable of Response, dict 43 | # or Item objects. 44 | pass 45 | 46 | def process_start_requests(start_requests, spider): 47 | # Called with the start requests of the spider, and works 48 | # similarly to the process_spider_output() method, except 49 | # that it doesn’t have a response associated. 50 | 51 | # Must return only requests (not items). 52 | for r in start_requests: 53 | yield r 54 | 55 | def spider_opened(self, spider): 56 | spider.logger.info('Spider opened: %s' % spider.name) 57 | -------------------------------------------------------------------------------- /6_web/brickset_app/item/templates/item/list.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block contents %} 4 | 5 |
6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | {% for item in items %} 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 39 | 45 | 46 | {% endfor %} 47 | 48 |
セット番号画像名前ピース数ミニフィグ数US価格レーティング
{{ item.set_number }}{{ item.name }}{{ item.piece_count }}{{ item.minifig_count }}{{ item.us_price }}{{ item.rating }} 34 |
35 | {% csrf_token %} 36 |

37 |
38 |
40 |
41 | {% csrf_token %} 42 |

43 |
44 |
49 |
50 |
51 | 52 | {% endblock %} 53 | 54 | -------------------------------------------------------------------------------- /6_web/brickset_app/item/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11.2 on 2017-06-11 02:32 3 | from __future__ import unicode_literals 4 | 5 | from django.conf import settings 6 | from django.db import migrations, models 7 | import django.db.models.deletion 8 | 9 | 10 | class Migration(migrations.Migration): 11 | 12 | initial = True 13 | 14 | dependencies = [ 15 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 16 | ] 17 | 18 | operations = [ 19 | migrations.CreateModel( 20 | name='Item', 21 | fields=[ 22 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 23 | ('set_number', models.IntegerField(verbose_name='セット番号')), 24 | ('name', models.CharField(max_length=255, verbose_name='名前')), 25 | ('image_url', models.URLField(blank=True, verbose_name='画像URL')), 26 | ('rating', models.FloatField(default=0.0, verbose_name='レーティング')), 27 | ('piece_count', models.IntegerField(default=0, verbose_name='ピース数')), 28 | ('minifig_count', models.IntegerField(default=0, verbose_name='ミニフィグ数')), 29 | ('us_price', models.FloatField(default=0.0, verbose_name='US価格')), 30 | ('owner_count', models.IntegerField(default=0, verbose_name='オーナー数')), 31 | ('want_it_count', models.IntegerField(default=0, verbose_name='欲しい数')), 32 | ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='作成日時')), 33 | ('updated_at', models.DateTimeField(auto_now=True, verbose_name='更新日時')), 34 | ], 35 | ), 36 | migrations.CreateModel( 37 | name='WishList', 38 | fields=[ 39 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 40 | ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='作成日時')), 41 | ('updated_at', models.DateTimeField(auto_now=True, verbose_name='更新日時')), 42 | ('items', models.ManyToManyField(to='item.Item')), 43 | ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 44 | ], 45 | ), 46 | ] 47 | -------------------------------------------------------------------------------- /6_web/brickset_app/item/views.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth.decorators import login_required 2 | from django.core.urlresolvers import reverse 3 | from django.http import HttpResponseRedirect 4 | from django.shortcuts import get_object_or_404 5 | from django.template.response import TemplateResponse, HttpResponse 6 | from django.views.decorators.http import require_POST 7 | 8 | from .forms import ItemForm 9 | from .models import Item, WishList 10 | 11 | 12 | @login_required 13 | def index(request): 14 | # item一覧を取得し、辞書に格納 15 | context = {'items': Item.objects.all()} 16 | return TemplateResponse(request, 'item/list.html', context=context) 17 | 18 | 19 | def post(request, post_id): 20 | return HttpResponse('post_idは = {}です'.format(post_id)) 21 | 22 | 23 | def news(request, slug): 24 | return HttpResponse('slugは = {}です'.format(slug)) 25 | 26 | 27 | @login_required 28 | def edit(request, item_id): 29 | # itemの取得(itemが存在しない場合404を表示) 30 | item = get_object_or_404(Item, pk=item_id) 31 | 32 | if request.method == 'POST': 33 | form = ItemForm(request.POST, instance=item) 34 | if form.is_valid(): 35 | form.save() 36 | return HttpResponseRedirect(reverse('item_index')) 37 | else: 38 | form = ItemForm(instance=item) 39 | 40 | context = {'form': form, 'item': item} 41 | return TemplateResponse(request, 'item/edit.html', context=context) 42 | 43 | 44 | @login_required 45 | @require_POST 46 | def delete(request, item_id): 47 | # itemの取得(itemが存在しない場合404を表示) 48 | item = get_object_or_404(Item, pk=item_id) 49 | item.delete() 50 | 51 | return HttpResponseRedirect(reverse('item_index')) 52 | 53 | 54 | @login_required 55 | @require_POST 56 | def add_to_wish_list(request, item_id): 57 | # itemの取得(itemが存在しない場合404を表示) 58 | item = get_object_or_404(Item, pk=item_id) 59 | 60 | # wish_listの取得(wish_listが存在しない新規に作成) 61 | wish_list, created = WishList.objects.get_or_create(user=request.user) 62 | 63 | # wish_listに該当するitemを追加 64 | wish_list.items.add(item) 65 | 66 | return HttpResponseRedirect(reverse('wish_list_index')) 67 | 68 | 69 | @login_required 70 | @require_POST 71 | def delete_from_wish_list(request, item_id): 72 | # itemの取得(itemが存在しない場合404を表示) 73 | item = get_object_or_404(Item, pk=item_id) 74 | 75 | # wish_listの取得(wish_listが存在しない新規に作成) 76 | wish_list, created = WishList.objects.get_or_create(user=request.user) 77 | 78 | # wish_listから該当するitemを削除 79 | wish_list.items.remove(item) 80 | 81 | return HttpResponseRedirect(reverse('wish_list_index')) 82 | 83 | 84 | @login_required 85 | def wish_list_index(request): 86 | # 欲しいものリストの取得 87 | wish_list, created = WishList.objects.get_or_create(user=request.user) 88 | 89 | # 欲しいものに含まれるitem一覧を取得し、辞書に格納 90 | context = {'items': wish_list.items.all()} 91 | return TemplateResponse(request, 'wish_list/list.html', context=context) 92 | -------------------------------------------------------------------------------- /4_scraping/lego_scraper/lego_scraper/settings.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Scrapy settings for lego_scraper project 4 | # 5 | # For simplicity, this file contains only settings considered important or 6 | # commonly used. You can find more settings consulting the documentation: 7 | # 8 | # http://doc.scrapy.org/en/latest/topics/settings.html 9 | # http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html 10 | # http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html 11 | 12 | BOT_NAME = 'lego_scraper' 13 | 14 | SPIDER_MODULES = ['lego_scraper.spiders'] 15 | NEWSPIDER_MODULE = 'lego_scraper.spiders' 16 | 17 | 18 | # Crawl responsibly by identifying yourself (and your website) on the user-agent 19 | #USER_AGENT = 'lego_scraper (+http://www.yourdomain.com)' 20 | 21 | # Obey robots.txt rules 22 | ROBOTSTXT_OBEY = True 23 | 24 | # Configure maximum concurrent requests performed by Scrapy (default: 16) 25 | #CONCURRENT_REQUESTS = 32 26 | 27 | # Configure a delay for requests for the same website (default: 0) 28 | # See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay 29 | # See also autothrottle settings and docs 30 | #DOWNLOAD_DELAY = 3 31 | # The download delay setting will honor only one of: 32 | #CONCURRENT_REQUESTS_PER_DOMAIN = 16 33 | #CONCURRENT_REQUESTS_PER_IP = 16 34 | 35 | # Disable cookies (enabled by default) 36 | #COOKIES_ENABLED = False 37 | 38 | # Disable Telnet Console (enabled by default) 39 | #TELNETCONSOLE_ENABLED = False 40 | 41 | # Override the default request headers: 42 | #DEFAULT_REQUEST_HEADERS = { 43 | # 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 44 | # 'Accept-Language': 'en', 45 | #} 46 | 47 | # Enable or disable spider middlewares 48 | # See http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html 49 | #SPIDER_MIDDLEWARES = { 50 | # 'lego_scraper.middlewares.LegoScraperSpiderMiddleware': 543, 51 | #} 52 | 53 | # Enable or disable downloader middlewares 54 | # See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html 55 | #DOWNLOADER_MIDDLEWARES = { 56 | # 'lego_scraper.middlewares.MyCustomDownloaderMiddleware': 543, 57 | #} 58 | 59 | # Enable or disable extensions 60 | # See http://scrapy.readthedocs.org/en/latest/topics/extensions.html 61 | #EXTENSIONS = { 62 | # 'scrapy.extensions.telnet.TelnetConsole': None, 63 | #} 64 | 65 | # Configure item pipelines 66 | # See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html 67 | #ITEM_PIPELINES = { 68 | # 'lego_scraper.pipelines.LegoScraperPipeline': 300, 69 | #} 70 | 71 | # Enable and configure the AutoThrottle extension (disabled by default) 72 | # See http://doc.scrapy.org/en/latest/topics/autothrottle.html 73 | #AUTOTHROTTLE_ENABLED = True 74 | # The initial download delay 75 | #AUTOTHROTTLE_START_DELAY = 5 76 | # The maximum download delay to be set in case of high latencies 77 | #AUTOTHROTTLE_MAX_DELAY = 60 78 | # The average number of requests Scrapy should be sending in parallel to 79 | # each remote server 80 | #AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0 81 | # Enable showing throttling stats for every response received: 82 | #AUTOTHROTTLE_DEBUG = False 83 | 84 | # Enable and configure HTTP caching (disabled by default) 85 | # See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings 86 | HTTPCACHE_ENABLED = True 87 | #HTTPCACHE_EXPIRATION_SECS = 0 88 | #HTTPCACHE_DIR = 'httpcache' 89 | #HTTPCACHE_IGNORE_HTTP_CODES = [] 90 | #HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage' 91 | -------------------------------------------------------------------------------- /6_web/brickset_app/item/templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | アイテム管理画面 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 46 | 47 | 48 | 49 | 53 | 54 | 55 | 56 | 57 | 71 | 72 |
73 |
74 | 82 | 83 | {% block contents %}{% endblock %} 84 | 85 |
86 |
87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /6_web/brickset_app/brickset_app/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for brickset_app project. 3 | 4 | Generated by 'django-admin startproject' using Django 1.11.3. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.11/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/1.11/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = '8$=94=0q(kratngi4+)&qp$v^k@9z@bc#$bo$yd&v@)uq8t0x_' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'item.apps.ItemConfig', 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'brickset_app.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'brickset_app.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/1.11/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), # データベースファイルへのパス 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/1.11/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'ja' 108 | 109 | TIME_ZONE = 'Asia/Tokyo' 110 | 111 | USE_I18N = True 112 | 113 | USE_L10N = True 114 | 115 | USE_TZ = True 116 | 117 | 118 | # Static files (CSS, JavaScript, Images) 119 | # https://docs.djangoproject.com/en/1.11/howto/static-files/ 120 | 121 | STATIC_URL = '/static/' 122 | 123 | # ログイン用の設定 124 | LOGIN_REDIRECT_URL = '/item/' 125 | LOGIN_URL = '/accounts/login/' -------------------------------------------------------------------------------- /3_team/examples/conf.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # example documentation build configuration file, created by 5 | # sphinx-quickstart on Tue Aug 8 22:29:57 2017. 6 | # 7 | # This file is execfile()d with the current directory set to its 8 | # containing dir. 9 | # 10 | # Note that not all possible configuration values are present in this 11 | # autogenerated file. 12 | # 13 | # All configuration values have a default; values that are commented out 14 | # serve to show the default. 15 | 16 | # If extensions (or modules to document with autodoc) are in another directory, 17 | # add these directories to sys.path here. If the directory is relative to the 18 | # documentation root, use os.path.abspath to make it absolute, like shown here. 19 | # 20 | # import os 21 | # import sys 22 | # sys.path.insert(0, os.path.abspath('.')) 23 | 24 | 25 | # -- General configuration ------------------------------------------------ 26 | 27 | # If your documentation needs a minimal Sphinx version, state it here. 28 | # 29 | # needs_sphinx = '1.0' 30 | 31 | # Add any Sphinx extension module names here, as strings. They can be 32 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 33 | # ones. 34 | extensions = [] 35 | 36 | # Add any paths that contain templates here, relative to this directory. 37 | templates_path = ['_templates'] 38 | 39 | # The suffix(es) of source filenames. 40 | # You can specify multiple suffix as a list of string: 41 | # 42 | # source_suffix = ['.rst', '.md'] 43 | source_suffix = '.rst' 44 | 45 | # The master toctree document. 46 | master_doc = 'index' 47 | 48 | # General information about the project. 49 | project = 'example' 50 | copyright = '2017, TakesxiSximada' 51 | author = 'TakesxiSximada' 52 | 53 | # The version info for the project you're documenting, acts as replacement for 54 | # |version| and |release|, also used in various other places throughout the 55 | # built documents. 56 | # 57 | # The short X.Y version. 58 | version = '1' 59 | # The full version, including alpha/beta/rc tags. 60 | release = '1' 61 | 62 | # The language for content autogenerated by Sphinx. Refer to documentation 63 | # for a list of supported languages. 64 | # 65 | # This is also used if you do content translation via gettext catalogs. 66 | # Usually you set "language" from the command line for these cases. 67 | language = None 68 | 69 | # List of patterns, relative to source directory, that match files and 70 | # directories to ignore when looking for source files. 71 | # This patterns also effect to html_static_path and html_extra_path 72 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] 73 | 74 | # The name of the Pygments (syntax highlighting) style to use. 75 | pygments_style = 'sphinx' 76 | 77 | # If true, `todo` and `todoList` produce output, else they produce nothing. 78 | todo_include_todos = False 79 | 80 | 81 | # -- Options for HTML output ---------------------------------------------- 82 | 83 | # The theme to use for HTML and HTML Help pages. See the documentation for 84 | # a list of builtin themes. 85 | # 86 | html_theme = 'alabaster' 87 | 88 | # Theme options are theme-specific and customize the look and feel of a theme 89 | # further. For a list of options available for each theme, see the 90 | # documentation. 91 | # 92 | # html_theme_options = {} 93 | 94 | # Add any paths that contain custom static files (such as style sheets) here, 95 | # relative to this directory. They are copied after the builtin static files, 96 | # so a file named "default.css" will overwrite the builtin "default.css". 97 | html_static_path = ['_static'] 98 | 99 | # Custom sidebar templates, must be a dictionary that maps document names 100 | # to template names. 101 | # 102 | # This is required for the alabaster theme 103 | # refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars 104 | html_sidebars = { 105 | '**': [ 106 | 'about.html', 107 | 'navigation.html', 108 | 'relations.html', # needs 'show_related': True theme option to display 109 | 'searchbox.html', 110 | 'donate.html', 111 | ] 112 | } 113 | 114 | 115 | # -- Options for HTMLHelp output ------------------------------------------ 116 | 117 | # Output file base name for HTML help builder. 118 | htmlhelp_basename = 'exampledoc' 119 | 120 | 121 | # -- Options for LaTeX output --------------------------------------------- 122 | 123 | latex_elements = { 124 | # The paper size ('letterpaper' or 'a4paper'). 125 | # 126 | # 'papersize': 'letterpaper', 127 | 128 | # The font size ('10pt', '11pt' or '12pt'). 129 | # 130 | # 'pointsize': '10pt', 131 | 132 | # Additional stuff for the LaTeX preamble. 133 | # 134 | # 'preamble': '', 135 | 136 | # Latex figure (float) alignment 137 | # 138 | # 'figure_align': 'htbp', 139 | } 140 | 141 | # Grouping the document tree into LaTeX files. List of tuples 142 | # (source start file, target name, title, 143 | # author, documentclass [howto, manual, or own class]). 144 | latex_documents = [ 145 | (master_doc, 'example.tex', 'example Documentation', 146 | 'TakesxiSximada', 'manual'), 147 | ] 148 | 149 | 150 | # -- Options for manual page output --------------------------------------- 151 | 152 | # One entry per manual page. List of tuples 153 | # (source start file, name, description, authors, manual section). 154 | man_pages = [ 155 | (master_doc, 'example', 'example Documentation', 156 | [author], 1) 157 | ] 158 | 159 | 160 | # -- Options for Texinfo output ------------------------------------------- 161 | 162 | # Grouping the document tree into Texinfo files. List of tuples 163 | # (source start file, target name, title, author, 164 | # dir menu entry, description, category) 165 | texinfo_documents = [ 166 | (master_doc, 'example', 'example Documentation', 167 | author, 'example', 'One line description of project.', 168 | 'Miscellaneous'), 169 | ] 170 | 171 | 172 | 173 | -------------------------------------------------------------------------------- /2_guide/2_1.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": {}, 7 | "outputs": [ 8 | { 9 | "data": { 10 | "text/plain": [ 11 | "4" 12 | ] 13 | }, 14 | "execution_count": 1, 15 | "metadata": {}, 16 | "output_type": "execute_result" 17 | } 18 | ], 19 | "source": [ 20 | "2 + 2" 21 | ] 22 | }, 23 | { 24 | "cell_type": "code", 25 | "execution_count": 2, 26 | "metadata": {}, 27 | "outputs": [ 28 | { 29 | "data": { 30 | "text/plain": [ 31 | "-5" 32 | ] 33 | }, 34 | "execution_count": 2, 35 | "metadata": {}, 36 | "output_type": "execute_result" 37 | } 38 | ], 39 | "source": [ 40 | "3 - 8" 41 | ] 42 | }, 43 | { 44 | "cell_type": "code", 45 | "execution_count": 3, 46 | "metadata": {}, 47 | "outputs": [ 48 | { 49 | "data": { 50 | "text/plain": [ 51 | "54" 52 | ] 53 | }, 54 | "execution_count": 3, 55 | "metadata": {}, 56 | "output_type": "execute_result" 57 | } 58 | ], 59 | "source": [ 60 | "6 * 9" 61 | ] 62 | }, 63 | { 64 | "cell_type": "code", 65 | "execution_count": 4, 66 | "metadata": {}, 67 | "outputs": [ 68 | { 69 | "data": { 70 | "text/plain": [ 71 | "4.0" 72 | ] 73 | }, 74 | "execution_count": 4, 75 | "metadata": {}, 76 | "output_type": "execute_result" 77 | } 78 | ], 79 | "source": [ 80 | "8 / 2" 81 | ] 82 | }, 83 | { 84 | "cell_type": "code", 85 | "execution_count": 5, 86 | "metadata": {}, 87 | "outputs": [ 88 | { 89 | "data": { 90 | "text/plain": [ 91 | "1" 92 | ] 93 | }, 94 | "execution_count": 5, 95 | "metadata": {}, 96 | "output_type": "execute_result" 97 | } 98 | ], 99 | "source": [ 100 | "5 % 2" 101 | ] 102 | }, 103 | { 104 | "cell_type": "code", 105 | "execution_count": 6, 106 | "metadata": { 107 | "collapsed": true 108 | }, 109 | "outputs": [], 110 | "source": [ 111 | "width = 60" 112 | ] 113 | }, 114 | { 115 | "cell_type": "code", 116 | "execution_count": 7, 117 | "metadata": { 118 | "collapsed": true 119 | }, 120 | "outputs": [], 121 | "source": [ 122 | "height = 90" 123 | ] 124 | }, 125 | { 126 | "cell_type": "code", 127 | "execution_count": 8, 128 | "metadata": {}, 129 | "outputs": [ 130 | { 131 | "data": { 132 | "text/plain": [ 133 | "5400" 134 | ] 135 | }, 136 | "execution_count": 8, 137 | "metadata": {}, 138 | "output_type": "execute_result" 139 | } 140 | ], 141 | "source": [ 142 | "width * height" 143 | ] 144 | }, 145 | { 146 | "cell_type": "code", 147 | "execution_count": 9, 148 | "metadata": {}, 149 | "outputs": [ 150 | { 151 | "data": { 152 | "text/plain": [ 153 | "'Hello,world'" 154 | ] 155 | }, 156 | "execution_count": 9, 157 | "metadata": {}, 158 | "output_type": "execute_result" 159 | } 160 | ], 161 | "source": [ 162 | "'Hello,world'" 163 | ] 164 | }, 165 | { 166 | "cell_type": "code", 167 | "execution_count": 10, 168 | "metadata": {}, 169 | "outputs": [ 170 | { 171 | "data": { 172 | "text/plain": [ 173 | "\"Monty Python's Flying Circus\"" 174 | ] 175 | }, 176 | "execution_count": 10, 177 | "metadata": {}, 178 | "output_type": "execute_result" 179 | } 180 | ], 181 | "source": [ 182 | "\"Monty Python's Flying Circus\"" 183 | ] 184 | }, 185 | { 186 | "cell_type": "code", 187 | "execution_count": 11, 188 | "metadata": {}, 189 | "outputs": [ 190 | { 191 | "data": { 192 | "text/plain": [ 193 | "['Hello', 3]" 194 | ] 195 | }, 196 | "execution_count": 11, 197 | "metadata": {}, 198 | "output_type": "execute_result" 199 | } 200 | ], 201 | "source": [ 202 | "['Hello', 3]" 203 | ] 204 | }, 205 | { 206 | "cell_type": "code", 207 | "execution_count": 12, 208 | "metadata": { 209 | "collapsed": true 210 | }, 211 | "outputs": [], 212 | "source": [ 213 | "def add(a, b):\n", 214 | " return a + b\n" 215 | ] 216 | }, 217 | { 218 | "cell_type": "code", 219 | "execution_count": 13, 220 | "metadata": {}, 221 | "outputs": [ 222 | { 223 | "data": { 224 | "text/plain": [ 225 | "4" 226 | ] 227 | }, 228 | "execution_count": 13, 229 | "metadata": {}, 230 | "output_type": "execute_result" 231 | } 232 | ], 233 | "source": [ 234 | "add(1, 3)" 235 | ] 236 | }, 237 | { 238 | "cell_type": "code", 239 | "execution_count": 14, 240 | "metadata": { 241 | "collapsed": true 242 | }, 243 | "outputs": [], 244 | "source": [ 245 | "def calc_tax(price, tax_rate=0.08):\n", 246 | " return price + price * tax_rate\n" 247 | ] 248 | }, 249 | { 250 | "cell_type": "code", 251 | "execution_count": 15, 252 | "metadata": {}, 253 | "outputs": [ 254 | { 255 | "data": { 256 | "text/plain": [ 257 | "108.0" 258 | ] 259 | }, 260 | "execution_count": 15, 261 | "metadata": {}, 262 | "output_type": "execute_result" 263 | } 264 | ], 265 | "source": [ 266 | "calc_tax(100)" 267 | ] 268 | }, 269 | { 270 | "cell_type": "code", 271 | "execution_count": 16, 272 | "metadata": {}, 273 | "outputs": [ 274 | { 275 | "data": { 276 | "text/plain": [ 277 | "110.0" 278 | ] 279 | }, 280 | "execution_count": 16, 281 | "metadata": {}, 282 | "output_type": "execute_result" 283 | } 284 | ], 285 | "source": [ 286 | "calc_tax(100, 0.1)" 287 | ] 288 | }, 289 | { 290 | "cell_type": "code", 291 | "execution_count": 17, 292 | "metadata": {}, 293 | "outputs": [ 294 | { 295 | "data": { 296 | "text/plain": [ 297 | "110.0" 298 | ] 299 | }, 300 | "execution_count": 17, 301 | "metadata": {}, 302 | "output_type": "execute_result" 303 | } 304 | ], 305 | "source": [ 306 | "calc_tax(price=100, tax_rate=0.1)" 307 | ] 308 | }, 309 | { 310 | "cell_type": "code", 311 | "execution_count": 18, 312 | "metadata": {}, 313 | "outputs": [ 314 | { 315 | "data": { 316 | "text/plain": [ 317 | "110.0" 318 | ] 319 | }, 320 | "execution_count": 18, 321 | "metadata": {}, 322 | "output_type": "execute_result" 323 | } 324 | ], 325 | "source": [ 326 | "calc_tax(tax_rate=0.1, price=100)" 327 | ] 328 | }, 329 | { 330 | "cell_type": "code", 331 | "execution_count": 19, 332 | "metadata": {}, 333 | "outputs": [ 334 | { 335 | "data": { 336 | "text/plain": [ 337 | "range(0, 10)" 338 | ] 339 | }, 340 | "execution_count": 19, 341 | "metadata": {}, 342 | "output_type": "execute_result" 343 | } 344 | ], 345 | "source": [ 346 | "range(10)" 347 | ] 348 | }, 349 | { 350 | "cell_type": "code", 351 | "execution_count": 20, 352 | "metadata": {}, 353 | "outputs": [ 354 | { 355 | "data": { 356 | "text/plain": [ 357 | "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]" 358 | ] 359 | }, 360 | "execution_count": 20, 361 | "metadata": {}, 362 | "output_type": "execute_result" 363 | } 364 | ], 365 | "source": [ 366 | "list(range(10))" 367 | ] 368 | } 369 | ], 370 | "metadata": { 371 | "kernelspec": { 372 | "display_name": "Python 3", 373 | "language": "python", 374 | "name": "python3" 375 | }, 376 | "language_info": { 377 | "codemirror_mode": { 378 | "name": "ipython", 379 | "version": 3 380 | }, 381 | "file_extension": ".py", 382 | "mimetype": "text/x-python", 383 | "name": "python", 384 | "nbconvert_exporter": "python", 385 | "pygments_lexer": "ipython3", 386 | "version": "3.6.1" 387 | } 388 | }, 389 | "nbformat": 4, 390 | "nbformat_minor": 2 391 | } 392 | -------------------------------------------------------------------------------- /2_guide/2_4.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "## ファイル操作" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 1, 13 | "metadata": { 14 | "collapsed": true 15 | }, 16 | "outputs": [], 17 | "source": [ 18 | "f = open('todo.txt', encoding='utf-8')" 19 | ] 20 | }, 21 | { 22 | "cell_type": "code", 23 | "execution_count": 2, 24 | "metadata": { 25 | "collapsed": true 26 | }, 27 | "outputs": [], 28 | "source": [ 29 | "todo_str = f.read()" 30 | ] 31 | }, 32 | { 33 | "cell_type": "code", 34 | "execution_count": 3, 35 | "metadata": {}, 36 | "outputs": [ 37 | { 38 | "name": "stdout", 39 | "output_type": "stream", 40 | "text": [ 41 | "本を書く\n", 42 | "新しいPythonライブラリーを試す\n", 43 | "\n" 44 | ] 45 | } 46 | ], 47 | "source": [ 48 | "print(todo_str)" 49 | ] 50 | }, 51 | { 52 | "cell_type": "code", 53 | "execution_count": 4, 54 | "metadata": { 55 | "collapsed": true 56 | }, 57 | "outputs": [], 58 | "source": [ 59 | "f.close()" 60 | ] 61 | }, 62 | { 63 | "cell_type": "code", 64 | "execution_count": 5, 65 | "metadata": { 66 | "collapsed": true 67 | }, 68 | "outputs": [], 69 | "source": [ 70 | "with open('todo.txt', encoding='utf-8') as f:\n", 71 | " todo_str = f.read()\n" 72 | ] 73 | }, 74 | { 75 | "cell_type": "code", 76 | "execution_count": 6, 77 | "metadata": {}, 78 | "outputs": [ 79 | { 80 | "name": "stdout", 81 | "output_type": "stream", 82 | "text": [ 83 | "本を書く\n", 84 | "新しいPythonライブラリーを試す\n", 85 | "\n" 86 | ] 87 | } 88 | ], 89 | "source": [ 90 | "print(todo_str)" 91 | ] 92 | }, 93 | { 94 | "cell_type": "code", 95 | "execution_count": 7, 96 | "metadata": { 97 | "collapsed": true 98 | }, 99 | "outputs": [], 100 | "source": [ 101 | "f = open('memo.txt', 'w', encoding='utf-8')" 102 | ] 103 | }, 104 | { 105 | "cell_type": "code", 106 | "execution_count": 8, 107 | "metadata": {}, 108 | "outputs": [ 109 | { 110 | "data": { 111 | "text/plain": [ 112 | "<_io.TextIOWrapper name='memo.txt' mode='w' encoding='utf-8'>" 113 | ] 114 | }, 115 | "execution_count": 8, 116 | "metadata": {}, 117 | "output_type": "execute_result" 118 | } 119 | ], 120 | "source": [ 121 | "f" 122 | ] 123 | }, 124 | { 125 | "cell_type": "code", 126 | "execution_count": 9, 127 | "metadata": {}, 128 | "outputs": [ 129 | { 130 | "data": { 131 | "text/plain": [ 132 | "3" 133 | ] 134 | }, 135 | "execution_count": 9, 136 | "metadata": {}, 137 | "output_type": "execute_result" 138 | } 139 | ], 140 | "source": [ 141 | "f.write('今日は')" 142 | ] 143 | }, 144 | { 145 | "cell_type": "code", 146 | "execution_count": 10, 147 | "metadata": {}, 148 | "outputs": [ 149 | { 150 | "data": { 151 | "text/plain": [ 152 | "10" 153 | ] 154 | }, 155 | "execution_count": 10, 156 | "metadata": {}, 157 | "output_type": "execute_result" 158 | } 159 | ], 160 | "source": [ 161 | "f.write('ラーメンが食べたい\\n')" 162 | ] 163 | }, 164 | { 165 | "cell_type": "code", 166 | "execution_count": 11, 167 | "metadata": { 168 | "collapsed": true 169 | }, 170 | "outputs": [], 171 | "source": [ 172 | "f.close()" 173 | ] 174 | }, 175 | { 176 | "cell_type": "code", 177 | "execution_count": 12, 178 | "metadata": { 179 | "collapsed": true 180 | }, 181 | "outputs": [], 182 | "source": [ 183 | "f = open('memo.txt', 'a', encoding='utf-8')" 184 | ] 185 | }, 186 | { 187 | "cell_type": "code", 188 | "execution_count": 13, 189 | "metadata": {}, 190 | "outputs": [ 191 | { 192 | "data": { 193 | "text/plain": [ 194 | "9" 195 | ] 196 | }, 197 | "execution_count": 13, 198 | "metadata": {}, 199 | "output_type": "execute_result" 200 | } 201 | ], 202 | "source": [ 203 | "f.write('夕飯は何にしよう\\n')" 204 | ] 205 | }, 206 | { 207 | "cell_type": "code", 208 | "execution_count": 14, 209 | "metadata": { 210 | "collapsed": true 211 | }, 212 | "outputs": [], 213 | "source": [ 214 | "f.close()" 215 | ] 216 | }, 217 | { 218 | "cell_type": "code", 219 | "execution_count": 15, 220 | "metadata": { 221 | "collapsed": true 222 | }, 223 | "outputs": [], 224 | "source": [ 225 | "f = open('photo.png', 'rb')" 226 | ] 227 | }, 228 | { 229 | "cell_type": "code", 230 | "execution_count": 16, 231 | "metadata": { 232 | "collapsed": true 233 | }, 234 | "outputs": [], 235 | "source": [ 236 | "content = f.read()" 237 | ] 238 | }, 239 | { 240 | "cell_type": "code", 241 | "execution_count": 17, 242 | "metadata": {}, 243 | "outputs": [ 244 | { 245 | "data": { 246 | "text/plain": [ 247 | "b'\\x89PNG\\r\\n\\x1a\\n'" 248 | ] 249 | }, 250 | "execution_count": 17, 251 | "metadata": {}, 252 | "output_type": "execute_result" 253 | } 254 | ], 255 | "source": [ 256 | "content[:8]" 257 | ] 258 | }, 259 | { 260 | "cell_type": "markdown", 261 | "metadata": {}, 262 | "source": [ 263 | "## モジュール" 264 | ] 265 | }, 266 | { 267 | "cell_type": "code", 268 | "execution_count": 18, 269 | "metadata": { 270 | "collapsed": true 271 | }, 272 | "outputs": [], 273 | "source": [ 274 | "import calc" 275 | ] 276 | }, 277 | { 278 | "cell_type": "code", 279 | "execution_count": 19, 280 | "metadata": {}, 281 | "outputs": [ 282 | { 283 | "data": { 284 | "text/plain": [ 285 | "" 286 | ] 287 | }, 288 | "execution_count": 19, 289 | "metadata": {}, 290 | "output_type": "execute_result" 291 | } 292 | ], 293 | "source": [ 294 | "calc" 295 | ] 296 | }, 297 | { 298 | "cell_type": "code", 299 | "execution_count": 20, 300 | "metadata": {}, 301 | "outputs": [ 302 | { 303 | "data": { 304 | "text/plain": [ 305 | "3" 306 | ] 307 | }, 308 | "execution_count": 20, 309 | "metadata": {}, 310 | "output_type": "execute_result" 311 | } 312 | ], 313 | "source": [ 314 | "calc.add(1, 2)" 315 | ] 316 | }, 317 | { 318 | "cell_type": "code", 319 | "execution_count": 21, 320 | "metadata": { 321 | "collapsed": true 322 | }, 323 | "outputs": [], 324 | "source": [ 325 | "from calc import add" 326 | ] 327 | }, 328 | { 329 | "cell_type": "code", 330 | "execution_count": 22, 331 | "metadata": {}, 332 | "outputs": [ 333 | { 334 | "data": { 335 | "text/plain": [ 336 | "3" 337 | ] 338 | }, 339 | "execution_count": 22, 340 | "metadata": {}, 341 | "output_type": "execute_result" 342 | } 343 | ], 344 | "source": [ 345 | "add(1, 2)" 346 | ] 347 | }, 348 | { 349 | "cell_type": "code", 350 | "execution_count": 23, 351 | "metadata": { 352 | "collapsed": true 353 | }, 354 | "outputs": [], 355 | "source": [ 356 | "import calc as c" 357 | ] 358 | }, 359 | { 360 | "cell_type": "code", 361 | "execution_count": 24, 362 | "metadata": {}, 363 | "outputs": [ 364 | { 365 | "data": { 366 | "text/plain": [ 367 | "3" 368 | ] 369 | }, 370 | "execution_count": 24, 371 | "metadata": {}, 372 | "output_type": "execute_result" 373 | } 374 | ], 375 | "source": [ 376 | "c.add(1, 2)" 377 | ] 378 | }, 379 | { 380 | "cell_type": "code", 381 | "execution_count": 25, 382 | "metadata": { 383 | "collapsed": true 384 | }, 385 | "outputs": [], 386 | "source": [ 387 | "from calc import add, sub" 388 | ] 389 | }, 390 | { 391 | "cell_type": "code", 392 | "execution_count": 26, 393 | "metadata": {}, 394 | "outputs": [ 395 | { 396 | "data": { 397 | "text/plain": [ 398 | "3" 399 | ] 400 | }, 401 | "execution_count": 26, 402 | "metadata": {}, 403 | "output_type": "execute_result" 404 | } 405 | ], 406 | "source": [ 407 | "add(1, 2)" 408 | ] 409 | }, 410 | { 411 | "cell_type": "code", 412 | "execution_count": 27, 413 | "metadata": {}, 414 | "outputs": [ 415 | { 416 | "data": { 417 | "text/plain": [ 418 | "1" 419 | ] 420 | }, 421 | "execution_count": 27, 422 | "metadata": {}, 423 | "output_type": "execute_result" 424 | } 425 | ], 426 | "source": [ 427 | "sub(2, 1)" 428 | ] 429 | }, 430 | { 431 | "cell_type": "code", 432 | "execution_count": 28, 433 | "metadata": { 434 | "collapsed": true 435 | }, 436 | "outputs": [], 437 | "source": [ 438 | "from calc import (\n", 439 | " add,\n", 440 | " sub,\n", 441 | ")" 442 | ] 443 | }, 444 | { 445 | "cell_type": "markdown", 446 | "metadata": {}, 447 | "source": [ 448 | "## 標準ライブラリの利用" 449 | ] 450 | }, 451 | { 452 | "cell_type": "code", 453 | "execution_count": 29, 454 | "metadata": { 455 | "collapsed": true 456 | }, 457 | "outputs": [], 458 | "source": [ 459 | "import re" 460 | ] 461 | }, 462 | { 463 | "cell_type": "code", 464 | "execution_count": 30, 465 | "metadata": { 466 | "collapsed": true 467 | }, 468 | "outputs": [], 469 | "source": [ 470 | "m = re.search('(P(yth|l)|Z)o[pn]e?', 'Python')" 471 | ] 472 | }, 473 | { 474 | "cell_type": "code", 475 | "execution_count": 31, 476 | "metadata": {}, 477 | "outputs": [ 478 | { 479 | "data": { 480 | "text/plain": [ 481 | "<_sre.SRE_Match object; span=(0, 6), match='Python'>" 482 | ] 483 | }, 484 | "execution_count": 31, 485 | "metadata": {}, 486 | "output_type": "execute_result" 487 | } 488 | ], 489 | "source": [ 490 | "m" 491 | ] 492 | }, 493 | { 494 | "cell_type": "code", 495 | "execution_count": 32, 496 | "metadata": {}, 497 | "outputs": [ 498 | { 499 | "data": { 500 | "text/plain": [ 501 | "'Python'" 502 | ] 503 | }, 504 | "execution_count": 32, 505 | "metadata": {}, 506 | "output_type": "execute_result" 507 | } 508 | ], 509 | "source": [ 510 | "m[0]" 511 | ] 512 | }, 513 | { 514 | "cell_type": "code", 515 | "execution_count": 33, 516 | "metadata": {}, 517 | "outputs": [ 518 | { 519 | "data": { 520 | "text/plain": [ 521 | "'Python'" 522 | ] 523 | }, 524 | "execution_count": 33, 525 | "metadata": {}, 526 | "output_type": "execute_result" 527 | } 528 | ], 529 | "source": [ 530 | "m.group(0)" 531 | ] 532 | }, 533 | { 534 | "cell_type": "code", 535 | "execution_count": 34, 536 | "metadata": { 537 | "collapsed": true 538 | }, 539 | "outputs": [], 540 | "source": [ 541 | "m = re.search('py(thon)', 'python')" 542 | ] 543 | }, 544 | { 545 | "cell_type": "code", 546 | "execution_count": 35, 547 | "metadata": {}, 548 | "outputs": [ 549 | { 550 | "data": { 551 | "text/plain": [ 552 | "'python'" 553 | ] 554 | }, 555 | "execution_count": 35, 556 | "metadata": {}, 557 | "output_type": "execute_result" 558 | } 559 | ], 560 | "source": [ 561 | "m[0]" 562 | ] 563 | }, 564 | { 565 | "cell_type": "code", 566 | "execution_count": 36, 567 | "metadata": {}, 568 | "outputs": [ 569 | { 570 | "data": { 571 | "text/plain": [ 572 | "'thon'" 573 | ] 574 | }, 575 | "execution_count": 36, 576 | "metadata": {}, 577 | "output_type": "execute_result" 578 | } 579 | ], 580 | "source": [ 581 | "m[1]" 582 | ] 583 | }, 584 | { 585 | "cell_type": "code", 586 | "execution_count": 37, 587 | "metadata": { 588 | "collapsed": true 589 | }, 590 | "outputs": [], 591 | "source": [ 592 | "re.search('py', 'ruby')" 593 | ] 594 | } 595 | ], 596 | "metadata": { 597 | "kernelspec": { 598 | "display_name": "Python 3", 599 | "language": "python", 600 | "name": "python3" 601 | }, 602 | "language_info": { 603 | "codemirror_mode": { 604 | "name": "ipython", 605 | "version": 3 606 | }, 607 | "file_extension": ".py", 608 | "mimetype": "text/x-python", 609 | "name": "python", 610 | "nbconvert_exporter": "python", 611 | "pygments_lexer": "ipython3", 612 | "version": "3.6.1" 613 | } 614 | }, 615 | "nbformat": 4, 616 | "nbformat_minor": 2 617 | } 618 | -------------------------------------------------------------------------------- /column/column.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# 便利な標準ライブラリ、サードパーティ製パッケージ\n", 8 | "\n", 9 | "* コラムのコードを実行した Jupyter Notebook" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "## Pythonの付属バッテリー、標準ライブラリ\n", 17 | "\n", 18 | "### sysとos:システムパラメータとOS" 19 | ] 20 | }, 21 | { 22 | "cell_type": "code", 23 | "execution_count": 6, 24 | "metadata": {}, 25 | "outputs": [ 26 | { 27 | "data": { 28 | "text/plain": [ 29 | "'/Users/takanori/Books/pymook-samplecode/2_column/spam/spam'" 30 | ] 31 | }, 32 | "execution_count": 6, 33 | "metadata": {}, 34 | "output_type": "execute_result" 35 | } 36 | ], 37 | "source": [ 38 | "import os\n", 39 | "os.mkdir('spam') # ディレクトリを作成する\n", 40 | "os.chdir('spam') # ディレクトリを移動する\n", 41 | "os.getcwd() # 現在のディレクトリを取得する\n", 42 | "\n", 43 | "os.chdir('..') # 元のディレクトリに戻る" 44 | ] 45 | }, 46 | { 47 | "cell_type": "code", 48 | "execution_count": 2, 49 | "metadata": {}, 50 | "outputs": [ 51 | { 52 | "ename": "SystemExit", 53 | "evalue": "1", 54 | "output_type": "error", 55 | "traceback": [ 56 | "An exception has occurred, use %tb to see the full traceback.\n", 57 | "\u001b[0;31mSystemExit\u001b[0m\u001b[0;31m:\u001b[0m 1\n" 58 | ] 59 | }, 60 | { 61 | "name": "stderr", 62 | "output_type": "stream", 63 | "text": [ 64 | "/Users/takanori/Books/pymook-samplecode/2_column/env/lib/python3.6/site-packages/IPython/core/interactiveshell.py:2870: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.\n", 65 | " warn(\"To exit: use 'exit', 'quit', or Ctrl-D.\", stacklevel=1)\n" 66 | ] 67 | } 68 | ], 69 | "source": [ 70 | "import sys\n", 71 | "sys.exit(1) # 終了ステータス1で異常終了する" 72 | ] 73 | }, 74 | { 75 | "cell_type": "markdown", 76 | "metadata": {}, 77 | "source": [ 78 | "### timeとdatetime:日付と時刻" 79 | ] 80 | }, 81 | { 82 | "cell_type": "code", 83 | "execution_count": 3, 84 | "metadata": {}, 85 | "outputs": [ 86 | { 87 | "data": { 88 | "text/plain": [ 89 | "'2017-08-03 23:57:40'" 90 | ] 91 | }, 92 | "execution_count": 3, 93 | "metadata": {}, 94 | "output_type": "execute_result" 95 | } 96 | ], 97 | "source": [ 98 | "import time\n", 99 | "localtime = time.localtime() # 現在時刻をローカルタイムで取得する\n", 100 | "time.strftime('%Y-%m-%d %H:%M:%S', localtime) # 日時をフォーマットして返す" 101 | ] 102 | }, 103 | { 104 | "cell_type": "code", 105 | "execution_count": 4, 106 | "metadata": {}, 107 | "outputs": [ 108 | { 109 | "data": { 110 | "text/plain": [ 111 | "'2017-08-03T23:57:53.926785'" 112 | ] 113 | }, 114 | "execution_count": 4, 115 | "metadata": {}, 116 | "output_type": "execute_result" 117 | } 118 | ], 119 | "source": [ 120 | "import datetime\n", 121 | "now = datetime.datetime.now() # 現在日時を取得する\n", 122 | "now.isoformat() # 現在日時をISOフォーマットで返す" 123 | ] 124 | }, 125 | { 126 | "cell_type": "code", 127 | "execution_count": 5, 128 | "metadata": {}, 129 | "outputs": [ 130 | { 131 | "data": { 132 | "text/plain": [ 133 | "150" 134 | ] 135 | }, 136 | "execution_count": 5, 137 | "metadata": {}, 138 | "output_type": "execute_result" 139 | } 140 | ], 141 | "source": [ 142 | "nextyear = datetime.datetime(2018, 1, 1) # 2018年の1月1日の日時を生成\n", 143 | "delta = nextyear - now\n", 144 | "delta.days # 来年まで261日あることを確認" 145 | ] 146 | }, 147 | { 148 | "cell_type": "markdown", 149 | "metadata": {}, 150 | "source": [ 151 | "### mathとrandom:数学関数と乱数" 152 | ] 153 | }, 154 | { 155 | "cell_type": "code", 156 | "execution_count": 7, 157 | "metadata": {}, 158 | "outputs": [ 159 | { 160 | "name": "stdout", 161 | "output_type": "stream", 162 | "text": [ 163 | "3.141592653589793\n", 164 | "1.4142135623730951\n" 165 | ] 166 | } 167 | ], 168 | "source": [ 169 | "import math\n", 170 | "print(math.pi) # 定数π\n", 171 | "print(math.sqrt(2)) # 平方根" 172 | ] 173 | }, 174 | { 175 | "cell_type": "code", 176 | "execution_count": 8, 177 | "metadata": {}, 178 | "outputs": [ 179 | { 180 | "name": "stdout", 181 | "output_type": "stream", 182 | "text": [ 183 | "940\n", 184 | "spam\n", 185 | "['ham', 'spam', 'eggs', 'foo', 'bar', 'baz']\n" 186 | ] 187 | } 188 | ], 189 | "source": [ 190 | "import random\n", 191 | "print(random.randint(1, 1000)) # 指定された範囲(1から1000)の間の整数を返す\n", 192 | "data = ['spam', 'ham', 'eggs', 'foo', 'bar', 'baz']\n", 193 | "print(random.choice(data)) # ランダムに要素を取り出す\n", 194 | "random.shuffle(data) # 要素の順番をシャッフルする\n", 195 | "print(data)" 196 | ] 197 | }, 198 | { 199 | "cell_type": "markdown", 200 | "metadata": {}, 201 | "source": [ 202 | "### itertools:イテレータ生成関数" 203 | ] 204 | }, 205 | { 206 | "cell_type": "code", 207 | "execution_count": 9, 208 | "metadata": {}, 209 | "outputs": [ 210 | { 211 | "name": "stdout", 212 | "output_type": "stream", 213 | "text": [ 214 | "A\n", 215 | "B\n", 216 | "C\n", 217 | "D\n", 218 | "E\n", 219 | "F\n" 220 | ] 221 | } 222 | ], 223 | "source": [ 224 | "import itertools\n", 225 | "for x in itertools.chain('ABC', 'DEF'): # 全体をつなげて一つのシーケンスにする\n", 226 | " print(x)" 227 | ] 228 | }, 229 | { 230 | "cell_type": "code", 231 | "execution_count": 10, 232 | "metadata": {}, 233 | "outputs": [ 234 | { 235 | "name": "stdout", 236 | "output_type": "stream", 237 | "text": [ 238 | "('A', 'B')\n", 239 | "('A', 'C')\n", 240 | "('A', 'D')\n", 241 | "('B', 'C')\n", 242 | "('B', 'D')\n", 243 | "('C', 'D')\n" 244 | ] 245 | } 246 | ], 247 | "source": [ 248 | "for x in itertools.combinations('ABCD', 2): # 長さ2の組み合わせを返す\n", 249 | " print(x)" 250 | ] 251 | }, 252 | { 253 | "cell_type": "markdown", 254 | "metadata": {}, 255 | "source": [ 256 | "### shutil:高レベルなファイル操作" 257 | ] 258 | }, 259 | { 260 | "cell_type": "code", 261 | "execution_count": 28, 262 | "metadata": {}, 263 | "outputs": [], 264 | "source": [ 265 | "import shutil\n", 266 | "shutil.copytree('src_dir', 'dst_dir') # src_dir以下のファイルをdst_dirにコピーする\n", 267 | "shutil.rmtree('src_dir') # src_dir以下のファイルをすべて削除する" 268 | ] 269 | }, 270 | { 271 | "cell_type": "markdown", 272 | "metadata": {}, 273 | "source": [ 274 | "### json:JSONエンコーダとデコーダ" 275 | ] 276 | }, 277 | { 278 | "cell_type": "code", 279 | "execution_count": 12, 280 | "metadata": {}, 281 | "outputs": [ 282 | { 283 | "data": { 284 | "text/plain": [ 285 | "'{\"spam\": \"SPAM\", \"ham\": true, \"eggs\": null}'" 286 | ] 287 | }, 288 | "execution_count": 12, 289 | "metadata": {}, 290 | "output_type": "execute_result" 291 | } 292 | ], 293 | "source": [ 294 | "import json\n", 295 | "data = {'spam': 'SPAM', 'ham': True, 'eggs': None} # 辞書型のデータを定義\n", 296 | "json.dumps(data) # json形式の文字列に変換する" 297 | ] 298 | }, 299 | { 300 | "cell_type": "markdown", 301 | "metadata": {}, 302 | "source": [ 303 | "## Pythonをさらに強力にするサードパーティ製パッケージ\n", 304 | "\n", 305 | "* 下記のコマンドをターミナルで実行して、venv 環境を作成し、各種パッケージをインストールする\n", 306 | "\n", 307 | "```\n", 308 | "$ python3.6 -m venv env\n", 309 | "$ source env/bin/activate\n", 310 | "(env) $ pip install python-dateutil\n", 311 | "(env) $ pip install requests\n", 312 | "(env) $ pip install beautifulsoup4\n", 313 | "(env) $ pip install pillow\n", 314 | "```" 315 | ] 316 | }, 317 | { 318 | "cell_type": "markdown", 319 | "metadata": {}, 320 | "source": [ 321 | "### dateutil:日時操作の強力な拡張" 322 | ] 323 | }, 324 | { 325 | "cell_type": "code", 326 | "execution_count": 15, 327 | "metadata": {}, 328 | "outputs": [ 329 | { 330 | "data": { 331 | "text/plain": [ 332 | "datetime.datetime(2017, 4, 14, 20, 34, 20, tzinfo=tzutc())" 333 | ] 334 | }, 335 | "execution_count": 15, 336 | "metadata": {}, 337 | "output_type": "execute_result" 338 | } 339 | ], 340 | "source": [ 341 | "import dateutil.parser\n", 342 | "dateutil.parser.parse(\"Fri Apr 14 20:34:20 UTC 2017\") # 日付の文字列をdatetimeに変換" 343 | ] 344 | }, 345 | { 346 | "cell_type": "code", 347 | "execution_count": 16, 348 | "metadata": {}, 349 | "outputs": [ 350 | { 351 | "data": { 352 | "text/plain": [ 353 | "datetime.datetime(2017, 4, 14, 20, 34, 20, tzinfo=tzlocal())" 354 | ] 355 | }, 356 | "execution_count": 16, 357 | "metadata": {}, 358 | "output_type": "execute_result" 359 | } 360 | ], 361 | "source": [ 362 | "dateutil.parser.parse(\"2017-04-14 20:34:20 JST\")" 363 | ] 364 | }, 365 | { 366 | "cell_type": "code", 367 | "execution_count": 17, 368 | "metadata": {}, 369 | "outputs": [ 370 | { 371 | "data": { 372 | "text/plain": [ 373 | "datetime.datetime(2017, 4, 14, 0, 0)" 374 | ] 375 | }, 376 | "execution_count": 17, 377 | "metadata": {}, 378 | "output_type": "execute_result" 379 | } 380 | ], 381 | "source": [ 382 | "dateutil.parser.parse(\"Apr-14-2017\")" 383 | ] 384 | }, 385 | { 386 | "cell_type": "markdown", 387 | "metadata": {}, 388 | "source": [ 389 | "### Requests:わかりやすいHTTPクライアント" 390 | ] 391 | }, 392 | { 393 | "cell_type": "code", 394 | "execution_count": 19, 395 | "metadata": {}, 396 | "outputs": [ 397 | { 398 | "name": "stdout", 399 | "output_type": "stream", 400 | "text": [ 401 | "200 text/json; charset=utf-8\n", 402 | "【深層学習ハンズオン】Aidemy meetup vol.3(1回目/全4回)-画像識別AIを作ろう 2017-08-13T13:15:00+09:00\n", 403 | "【未経験者向け】一緒にプログラミング始めませんか?#03 2017-08-20T10:00:00+09:00\n", 404 | "【プログラミング未経験者向け】一緒にプログラミング始めませんか? 2017-06-25T10:00:00+09:00\n" 405 | ] 406 | } 407 | ], 408 | "source": [ 409 | "import requests\n", 410 | "\n", 411 | "r = requests.get('http://connpass.com/api/v1/event/?keyword=python') # 指定URLにアクセス\n", 412 | "print(r.status_code, r.headers['content-type']) # ステータス、コンテンツタイプを取得\n", 413 | "for event in r.json()['events'][:3]: # イベントの先頭3件を取得\n", 414 | " print(event['title'], event['started_at']) # イベントのタイトル、日時を表示" 415 | ] 416 | }, 417 | { 418 | "cell_type": "markdown", 419 | "metadata": {}, 420 | "source": [ 421 | "### BeautifulSoup 4:HTMLとXMLファイルのパーサー" 422 | ] 423 | }, 424 | { 425 | "cell_type": "code", 426 | "execution_count": 20, 427 | "metadata": {}, 428 | "outputs": [ 429 | { 430 | "name": "stdout", 431 | "output_type": "stream", 432 | "text": [ 433 | "300\n", 434 | "1. はじめに\n", 435 | "2. 組み込み関数\n", 436 | "3. 組み込み定数\n" 437 | ] 438 | } 439 | ], 440 | "source": [ 441 | "from bs4 import BeautifulSoup\n", 442 | "import requests\n", 443 | "r = requests.get('http://docs.python.jp/3/library/index.html')\n", 444 | "soup = BeautifulSoup(r.content, 'html.parser') # HTMLをパース\n", 445 | "toctree = soup.find('div', 'toctree-wrapper') # classがtoctree-wrapperのdiv要素を取得\n", 446 | "links = toctree.find_all('a') # aタグを全て取得\n", 447 | "print(len(links)) # リンクの数を取得\n", 448 | "for link in links[:3]: # 先頭3件を表示\n", 449 | " print(link.text)" 450 | ] 451 | }, 452 | { 453 | "cell_type": "markdown", 454 | "metadata": {}, 455 | "source": [ 456 | "### Pillow:画像処理ライブラリ" 457 | ] 458 | }, 459 | { 460 | "cell_type": "code", 461 | "execution_count": 27, 462 | "metadata": {}, 463 | "outputs": [], 464 | "source": [ 465 | "from PIL import Image\n", 466 | "image = Image.open('sample.jpg') # 画像を読み込む\n", 467 | "half = (image.size[0] // 2, image.size[1] // 2)\n", 468 | "half_image = image.resize(half, Image.ANTIALIAS) # 画像を1/2に縮小\n", 469 | "half_image.save('sample-half.jpg') # 縮小した画像を保存\n", 470 | "rotate_image = image.transpose(Image.ROTATE_90) # 画像を90度回転\n", 471 | "rotate_image.save('sample-rotate.png') # 回転した画像をPNG形式で保存" 472 | ] 473 | }, 474 | { 475 | "cell_type": "code", 476 | "execution_count": null, 477 | "metadata": { 478 | "collapsed": true 479 | }, 480 | "outputs": [], 481 | "source": [] 482 | } 483 | ], 484 | "metadata": { 485 | "kernelspec": { 486 | "display_name": "Python 3", 487 | "language": "python", 488 | "name": "python3" 489 | }, 490 | "language_info": { 491 | "codemirror_mode": { 492 | "name": "ipython", 493 | "version": 3 494 | }, 495 | "file_extension": ".py", 496 | "mimetype": "text/x-python", 497 | "name": "python", 498 | "nbconvert_exporter": "python", 499 | "pygments_lexer": "ipython3", 500 | "version": "3.6.2" 501 | } 502 | }, 503 | "nbformat": 4, 504 | "nbformat_minor": 2 505 | } 506 | -------------------------------------------------------------------------------- /2_guide/2_2.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "## 整数型" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 1, 13 | "metadata": {}, 14 | "outputs": [ 15 | { 16 | "data": { 17 | "text/plain": [ 18 | "4" 19 | ] 20 | }, 21 | "execution_count": 1, 22 | "metadata": {}, 23 | "output_type": "execute_result" 24 | } 25 | ], 26 | "source": [ 27 | "2 + 2" 28 | ] 29 | }, 30 | { 31 | "cell_type": "code", 32 | "execution_count": 2, 33 | "metadata": {}, 34 | "outputs": [ 35 | { 36 | "data": { 37 | "text/plain": [ 38 | "-5" 39 | ] 40 | }, 41 | "execution_count": 2, 42 | "metadata": {}, 43 | "output_type": "execute_result" 44 | } 45 | ], 46 | "source": [ 47 | "3 - 8" 48 | ] 49 | }, 50 | { 51 | "cell_type": "code", 52 | "execution_count": 3, 53 | "metadata": {}, 54 | "outputs": [ 55 | { 56 | "data": { 57 | "text/plain": [ 58 | "54" 59 | ] 60 | }, 61 | "execution_count": 3, 62 | "metadata": {}, 63 | "output_type": "execute_result" 64 | } 65 | ], 66 | "source": [ 67 | "6 * 9" 68 | ] 69 | }, 70 | { 71 | "cell_type": "code", 72 | "execution_count": 4, 73 | "metadata": {}, 74 | "outputs": [ 75 | { 76 | "data": { 77 | "text/plain": [ 78 | "4.0" 79 | ] 80 | }, 81 | "execution_count": 4, 82 | "metadata": {}, 83 | "output_type": "execute_result" 84 | } 85 | ], 86 | "source": [ 87 | "8 / 2" 88 | ] 89 | }, 90 | { 91 | "cell_type": "code", 92 | "execution_count": 5, 93 | "metadata": {}, 94 | "outputs": [ 95 | { 96 | "data": { 97 | "text/plain": [ 98 | "1" 99 | ] 100 | }, 101 | "execution_count": 5, 102 | "metadata": {}, 103 | "output_type": "execute_result" 104 | } 105 | ], 106 | "source": [ 107 | "5 % 2" 108 | ] 109 | }, 110 | { 111 | "cell_type": "code", 112 | "execution_count": 6, 113 | "metadata": {}, 114 | "outputs": [ 115 | { 116 | "data": { 117 | "text/plain": [ 118 | "25" 119 | ] 120 | }, 121 | "execution_count": 6, 122 | "metadata": {}, 123 | "output_type": "execute_result" 124 | } 125 | ], 126 | "source": [ 127 | "5 ** 2" 128 | ] 129 | }, 130 | { 131 | "cell_type": "code", 132 | "execution_count": 7, 133 | "metadata": {}, 134 | "outputs": [ 135 | { 136 | "data": { 137 | "text/plain": [ 138 | "3.3333333333333335" 139 | ] 140 | }, 141 | "execution_count": 7, 142 | "metadata": {}, 143 | "output_type": "execute_result" 144 | } 145 | ], 146 | "source": [ 147 | "10 / 3" 148 | ] 149 | }, 150 | { 151 | "cell_type": "code", 152 | "execution_count": 8, 153 | "metadata": {}, 154 | "outputs": [ 155 | { 156 | "data": { 157 | "text/plain": [ 158 | "3" 159 | ] 160 | }, 161 | "execution_count": 8, 162 | "metadata": {}, 163 | "output_type": "execute_result" 164 | } 165 | ], 166 | "source": [ 167 | "10 // 3" 168 | ] 169 | }, 170 | { 171 | "cell_type": "markdown", 172 | "metadata": {}, 173 | "source": [ 174 | "## 浮動小数点型" 175 | ] 176 | }, 177 | { 178 | "cell_type": "code", 179 | "execution_count": 9, 180 | "metadata": {}, 181 | "outputs": [ 182 | { 183 | "data": { 184 | "text/plain": [ 185 | "5.0" 186 | ] 187 | }, 188 | "execution_count": 9, 189 | "metadata": {}, 190 | "output_type": "execute_result" 191 | } 192 | ], 193 | "source": [ 194 | "5.0" 195 | ] 196 | }, 197 | { 198 | "cell_type": "code", 199 | "execution_count": 10, 200 | "metadata": {}, 201 | "outputs": [ 202 | { 203 | "data": { 204 | "text/plain": [ 205 | "10.2" 206 | ] 207 | }, 208 | "execution_count": 10, 209 | "metadata": {}, 210 | "output_type": "execute_result" 211 | } 212 | ], 213 | "source": [ 214 | "5.0 + 5.2" 215 | ] 216 | }, 217 | { 218 | "cell_type": "code", 219 | "execution_count": 11, 220 | "metadata": {}, 221 | "outputs": [ 222 | { 223 | "data": { 224 | "text/plain": [ 225 | "18.2" 226 | ] 227 | }, 228 | "execution_count": 11, 229 | "metadata": {}, 230 | "output_type": "execute_result" 231 | } 232 | ], 233 | "source": [ 234 | "10.2 + 8" 235 | ] 236 | }, 237 | { 238 | "cell_type": "markdown", 239 | "metadata": {}, 240 | "source": [ 241 | "## 文字列型" 242 | ] 243 | }, 244 | { 245 | "cell_type": "code", 246 | "execution_count": 12, 247 | "metadata": {}, 248 | "outputs": [ 249 | { 250 | "data": { 251 | "text/plain": [ 252 | "'Hello,world'" 253 | ] 254 | }, 255 | "execution_count": 12, 256 | "metadata": {}, 257 | "output_type": "execute_result" 258 | } 259 | ], 260 | "source": [ 261 | "'Hello,world'" 262 | ] 263 | }, 264 | { 265 | "cell_type": "code", 266 | "execution_count": 13, 267 | "metadata": {}, 268 | "outputs": [ 269 | { 270 | "data": { 271 | "text/plain": [ 272 | "'Hello,world'" 273 | ] 274 | }, 275 | "execution_count": 13, 276 | "metadata": {}, 277 | "output_type": "execute_result" 278 | } 279 | ], 280 | "source": [ 281 | "\"Hello,world\"" 282 | ] 283 | }, 284 | { 285 | "cell_type": "code", 286 | "execution_count": 14, 287 | "metadata": {}, 288 | "outputs": [ 289 | { 290 | "data": { 291 | "text/plain": [ 292 | "'吾輩は蛇である'" 293 | ] 294 | }, 295 | "execution_count": 14, 296 | "metadata": {}, 297 | "output_type": "execute_result" 298 | } 299 | ], 300 | "source": [ 301 | "'吾輩は蛇である'" 302 | ] 303 | }, 304 | { 305 | "cell_type": "code", 306 | "execution_count": 15, 307 | "metadata": {}, 308 | "outputs": [ 309 | { 310 | "name": "stdout", 311 | "output_type": "stream", 312 | "text": [ 313 | "I'm Hiroki\n" 314 | ] 315 | } 316 | ], 317 | "source": [ 318 | "print('I\\'m Hiroki')" 319 | ] 320 | }, 321 | { 322 | "cell_type": "code", 323 | "execution_count": 16, 324 | "metadata": {}, 325 | "outputs": [ 326 | { 327 | "name": "stdout", 328 | "output_type": "stream", 329 | "text": [ 330 | "Hello\n", 331 | "world\n" 332 | ] 333 | } 334 | ], 335 | "source": [ 336 | "print('Hello\\nworld')" 337 | ] 338 | }, 339 | { 340 | "cell_type": "code", 341 | "execution_count": 17, 342 | "metadata": {}, 343 | "outputs": [ 344 | { 345 | "data": { 346 | "text/plain": [ 347 | "'foo\\nbar\\nbaz\\n'" 348 | ] 349 | }, 350 | "execution_count": 17, 351 | "metadata": {}, 352 | "output_type": "execute_result" 353 | } 354 | ], 355 | "source": [ 356 | "\"\"\"foo\n", 357 | "bar\n", 358 | "baz\n", 359 | "\"\"\"" 360 | ] 361 | }, 362 | { 363 | "cell_type": "code", 364 | "execution_count": 18, 365 | "metadata": {}, 366 | "outputs": [ 367 | { 368 | "data": { 369 | "text/plain": [ 370 | "'Mt.Fuji'" 371 | ] 372 | }, 373 | "execution_count": 18, 374 | "metadata": {}, 375 | "output_type": "execute_result" 376 | } 377 | ], 378 | "source": [ 379 | "'Mt.' + 'Fuji'" 380 | ] 381 | }, 382 | { 383 | "cell_type": "code", 384 | "execution_count": 19, 385 | "metadata": {}, 386 | "outputs": [ 387 | { 388 | "data": { 389 | "text/plain": [ 390 | "'スパムスパムスパムスパムスパム'" 391 | ] 392 | }, 393 | "execution_count": 19, 394 | "metadata": {}, 395 | "output_type": "execute_result" 396 | } 397 | ], 398 | "source": [ 399 | "'スパム' * 5" 400 | ] 401 | }, 402 | { 403 | "cell_type": "code", 404 | "execution_count": 20, 405 | "metadata": {}, 406 | "outputs": [ 407 | { 408 | "data": { 409 | "text/plain": [ 410 | "'y'" 411 | ] 412 | }, 413 | "execution_count": 20, 414 | "metadata": {}, 415 | "output_type": "execute_result" 416 | } 417 | ], 418 | "source": [ 419 | "'python'[1]" 420 | ] 421 | }, 422 | { 423 | "cell_type": "code", 424 | "execution_count": 21, 425 | "metadata": {}, 426 | "outputs": [ 427 | { 428 | "data": { 429 | "text/plain": [ 430 | "'tho'" 431 | ] 432 | }, 433 | "execution_count": 21, 434 | "metadata": {}, 435 | "output_type": "execute_result" 436 | } 437 | ], 438 | "source": [ 439 | "'python'[2:5]" 440 | ] 441 | }, 442 | { 443 | "cell_type": "code", 444 | "execution_count": 22, 445 | "metadata": {}, 446 | "outputs": [ 447 | { 448 | "data": { 449 | "text/plain": [ 450 | "'pyt'" 451 | ] 452 | }, 453 | "execution_count": 22, 454 | "metadata": {}, 455 | "output_type": "execute_result" 456 | } 457 | ], 458 | "source": [ 459 | "'python'[:3]" 460 | ] 461 | }, 462 | { 463 | "cell_type": "code", 464 | "execution_count": 23, 465 | "metadata": {}, 466 | "outputs": [ 467 | { 468 | "data": { 469 | "text/plain": [ 470 | "'on'" 471 | ] 472 | }, 473 | "execution_count": 23, 474 | "metadata": {}, 475 | "output_type": "execute_result" 476 | } 477 | ], 478 | "source": [ 479 | "'python'[4:]" 480 | ] 481 | }, 482 | { 483 | "cell_type": "code", 484 | "execution_count": 24, 485 | "metadata": {}, 486 | "outputs": [ 487 | { 488 | "data": { 489 | "text/plain": [ 490 | "6" 491 | ] 492 | }, 493 | "execution_count": 24, 494 | "metadata": {}, 495 | "output_type": "execute_result" 496 | } 497 | ], 498 | "source": [ 499 | "len('python')" 500 | ] 501 | }, 502 | { 503 | "cell_type": "code", 504 | "execution_count": 25, 505 | "metadata": {}, 506 | "outputs": [ 507 | { 508 | "data": { 509 | "text/plain": [ 510 | "True" 511 | ] 512 | }, 513 | "execution_count": 25, 514 | "metadata": {}, 515 | "output_type": "execute_result" 516 | } 517 | ], 518 | "source": [ 519 | "'t' in 'python'" 520 | ] 521 | }, 522 | { 523 | "cell_type": "code", 524 | "execution_count": 26, 525 | "metadata": {}, 526 | "outputs": [ 527 | { 528 | "data": { 529 | "text/plain": [ 530 | "False" 531 | ] 532 | }, 533 | "execution_count": 26, 534 | "metadata": {}, 535 | "output_type": "execute_result" 536 | } 537 | ], 538 | "source": [ 539 | "'k' in 'python'" 540 | ] 541 | }, 542 | { 543 | "cell_type": "code", 544 | "execution_count": 27, 545 | "metadata": {}, 546 | "outputs": [ 547 | { 548 | "data": { 549 | "text/plain": [ 550 | "True" 551 | ] 552 | }, 553 | "execution_count": 27, 554 | "metadata": {}, 555 | "output_type": "execute_result" 556 | } 557 | ], 558 | "source": [ 559 | "'th' in 'python'" 560 | ] 561 | }, 562 | { 563 | "cell_type": "code", 564 | "execution_count": 28, 565 | "metadata": {}, 566 | "outputs": [ 567 | { 568 | "data": { 569 | "text/plain": [ 570 | "['pain', 'au', 'chocolat']" 571 | ] 572 | }, 573 | "execution_count": 28, 574 | "metadata": {}, 575 | "output_type": "execute_result" 576 | } 577 | ], 578 | "source": [ 579 | "'pain-au-chocolat'.split('-')" 580 | ] 581 | }, 582 | { 583 | "cell_type": "code", 584 | "execution_count": 29, 585 | "metadata": {}, 586 | "outputs": [ 587 | { 588 | "data": { 589 | "text/plain": [ 590 | "'pain-de-campagne'" 591 | ] 592 | }, 593 | "execution_count": 29, 594 | "metadata": {}, 595 | "output_type": "execute_result" 596 | } 597 | ], 598 | "source": [ 599 | "'-'.join(['pain', 'de', 'campagne'])" 600 | ] 601 | }, 602 | { 603 | "cell_type": "markdown", 604 | "metadata": {}, 605 | "source": [ 606 | "## バイト型" 607 | ] 608 | }, 609 | { 610 | "cell_type": "code", 611 | "execution_count": 30, 612 | "metadata": {}, 613 | "outputs": [ 614 | { 615 | "data": { 616 | "text/plain": [ 617 | "b'\\x89PNG\\r\\n\\x1a\\n'" 618 | ] 619 | }, 620 | "execution_count": 30, 621 | "metadata": {}, 622 | "output_type": "execute_result" 623 | } 624 | ], 625 | "source": [ 626 | "b'\\x89PNG\\r\\n\\x1a\\n'" 627 | ] 628 | }, 629 | { 630 | "cell_type": "code", 631 | "execution_count": 31, 632 | "metadata": {}, 633 | "outputs": [ 634 | { 635 | "data": { 636 | "text/plain": [ 637 | "b'\\xe6\\x97\\xa5\\xe6\\x9c\\xac'" 638 | ] 639 | }, 640 | "execution_count": 31, 641 | "metadata": {}, 642 | "output_type": "execute_result" 643 | } 644 | ], 645 | "source": [ 646 | "\"日本\".encode('utf-8')" 647 | ] 648 | }, 649 | { 650 | "cell_type": "code", 651 | "execution_count": 32, 652 | "metadata": {}, 653 | "outputs": [ 654 | { 655 | "data": { 656 | "text/plain": [ 657 | "'日'" 658 | ] 659 | }, 660 | "execution_count": 32, 661 | "metadata": {}, 662 | "output_type": "execute_result" 663 | } 664 | ], 665 | "source": [ 666 | "b'\\xe6\\x97\\xa5'.decode('utf-8')" 667 | ] 668 | } 669 | ], 670 | "metadata": { 671 | "kernelspec": { 672 | "display_name": "Python 3", 673 | "language": "python", 674 | "name": "python3" 675 | }, 676 | "language_info": { 677 | "codemirror_mode": { 678 | "name": "ipython", 679 | "version": 3 680 | }, 681 | "file_extension": ".py", 682 | "mimetype": "text/x-python", 683 | "name": "python", 684 | "nbconvert_exporter": "python", 685 | "pygments_lexer": "ipython3", 686 | "version": "3.6.1" 687 | } 688 | }, 689 | "nbformat": 4, 690 | "nbformat_minor": 2 691 | } 692 | -------------------------------------------------------------------------------- /4_scraping/4_2_scraping.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# 4.2 サードパーティ製パッケージを使ってスクレイピングに挑戦\n", 8 | "\n", 9 | "* Requests http://docs.python-requests.org/\n", 10 | "* Beautiful Soup http://www.crummy.com/software/BeautifulSoup/" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": 1, 16 | "metadata": { 17 | "collapsed": true 18 | }, 19 | "outputs": [], 20 | "source": [ 21 | "import requests\n", 22 | "import bs4" 23 | ] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "## RequestsでWebページを取得" 30 | ] 31 | }, 32 | { 33 | "cell_type": "code", 34 | "execution_count": 2, 35 | "metadata": {}, 36 | "outputs": [ 37 | { 38 | "data": { 39 | "text/plain": [ 40 | "200" 41 | ] 42 | }, 43 | "execution_count": 2, 44 | "metadata": {}, 45 | "output_type": "execute_result" 46 | } 47 | ], 48 | "source": [ 49 | "# Requestsでgihyo.jpのページのデータを取得\n", 50 | "import requests\n", 51 | "r = requests.get('http://gihyo.jp/lifestyle/clip/01/everyday-cat')\n", 52 | "r.status_code # ステータスコードを取得" 53 | ] 54 | }, 55 | { 56 | "cell_type": "code", 57 | "execution_count": 3, 58 | "metadata": {}, 59 | "outputs": [ 60 | { 61 | "data": { 62 | "text/plain": [ 63 | "'\\r\\n技評ねこ部通信|gihyo.jp … 技術評論社\n", 224 | "技評ねこ部通信|gihyo.jp … 技術評論社\n" 225 | ] 226 | } 227 | ], 228 | "source": [ 229 | "print(title) # タイトルの中身を確認\n", 230 | "print(title.text) # タイトルの中のテキストを取得" 231 | ] 232 | }, 233 | { 234 | "cell_type": "code", 235 | "execution_count": 10, 236 | "metadata": {}, 237 | "outputs": [ 238 | { 239 | "name": "stdout", 240 | "output_type": "stream", 241 | "text": [ 242 | "http://gihyo.jp/lifestyle/clip/01/everyday-cat/201708/04\n", 243 | "2017年8月4日 甘えん坊なはちべい\n" 244 | ] 245 | }, 246 | { 247 | "data": { 248 | "text/plain": [ 249 | "['2017年8月4日', '甘えん坊なはちべい']" 250 | ] 251 | }, 252 | "execution_count": 10, 253 | "metadata": {}, 254 | "output_type": "execute_result" 255 | } 256 | ], 257 | "source": [ 258 | "# 技評ねこ部通信の1件分のデータを取得\n", 259 | "div = soup.find('div', class_='readingContent01')\n", 260 | "li = div.find('li') # divタグの中の最初のliタグを取得\n", 261 | "print(li.a['href']) # liタグの中のaタグのhref属性の値を取得\n", 262 | "print(li.a.text) # aタグの中の文字列を取得\n", 263 | "li.a.text.split(maxsplit=1) # 文字列のsplit()で日付とタイトルに分割" 264 | ] 265 | }, 266 | { 267 | "cell_type": "code", 268 | "execution_count": 11, 269 | "metadata": {}, 270 | "outputs": [ 271 | { 272 | "name": "stdout", 273 | "output_type": "stream", 274 | "text": [ 275 | "2017年8月4日,甘えん坊なはちべい,http://gihyo.jp/lifestyle/clip/01/everyday-cat/201708/04\n", 276 | "2017年8月3日,ケーブルカー駅のしろくろこ,http://gihyo.jp/lifestyle/clip/01/everyday-cat/201708/03\n", 277 | "2017年8月2日,ビビりな丸子,http://gihyo.jp/lifestyle/clip/01/everyday-cat/201708/02\n", 278 | "2017年8月1日,河原の公園のしろくろこ,http://gihyo.jp/lifestyle/clip/01/everyday-cat/201708/01\n", 279 | "2017年7月31日,技評ねこ部の投稿コーナー!,http://gihyo.jp/lifestyle/clip/01/everyday-cat/201707/31\n", 280 | "2017年7月28日,しろこの青春,http://gihyo.jp/lifestyle/clip/01/everyday-cat/201707/28\n", 281 | "2017年7月27日,クリーニング屋のしろこ,http://gihyo.jp/lifestyle/clip/01/everyday-cat/201707/27\n", 282 | "2017年7月26日,見返りしろこ,http://gihyo.jp/lifestyle/clip/01/everyday-cat/201707/26\n", 283 | "2017年7月25日,2匹のしろこ,http://gihyo.jp/lifestyle/clip/01/everyday-cat/201707/25\n", 284 | "2017年7月24日,風通る公園のしろこ 三たび,http://gihyo.jp/lifestyle/clip/01/everyday-cat/201707/24\n", 285 | "2017年7月21日,塀の上のしろこ,http://gihyo.jp/lifestyle/clip/01/everyday-cat/201707/21\n", 286 | "2017年7月20日,マダムしろこのご近所しろこ,http://gihyo.jp/lifestyle/clip/01/everyday-cat/201707/20\n", 287 | "2017年7月19日,風通る公園のしろこ 再び,http://gihyo.jp/lifestyle/clip/01/everyday-cat/201707/19\n", 288 | "2017年7月18日,マダムしろこ,http://gihyo.jp/lifestyle/clip/01/everyday-cat/201707/18\n", 289 | "2017年7月14日,ドヤ顔のしろこ,http://gihyo.jp/lifestyle/clip/01/everyday-cat/201707/14\n", 290 | "2017年7月13日,風通る公園のしろこ,http://gihyo.jp/lifestyle/clip/01/everyday-cat/201707/13\n", 291 | "2017年7月12日,学校のしろこ,http://gihyo.jp/lifestyle/clip/01/everyday-cat/201707/12\n", 292 | "2017年7月11日,住宅街のしろこ 夜の部,http://gihyo.jp/lifestyle/clip/01/everyday-cat/201707/11\n", 293 | "2017年7月10日,住宅街のしろこ,http://gihyo.jp/lifestyle/clip/01/everyday-cat/201707/10\n", 294 | "2017年7月7日,植え込みのしろこ2,http://gihyo.jp/lifestyle/clip/01/everyday-cat/201707/07\n" 295 | ] 296 | } 297 | ], 298 | "source": [ 299 | "# 技評ねこ部通信の全データを取得\n", 300 | "div = soup.find('div', class_='readingContent01')\n", 301 | "for li in div.find_all('li'): # divタグの中の全liタグを取得\n", 302 | " url = li.a['href']\n", 303 | " date, text = li.a.text.split(maxsplit=1)\n", 304 | " print('{},{},{}'.format(date, text, url))" 305 | ] 306 | }, 307 | { 308 | "cell_type": "markdown", 309 | "metadata": {}, 310 | "source": [ 311 | "### Beautiful Soup 4を使いこなす" 312 | ] 313 | }, 314 | { 315 | "cell_type": "code", 316 | "execution_count": 12, 317 | "metadata": {}, 318 | "outputs": [ 319 | { 320 | "data": { 321 | "text/plain": [ 322 | "bs4.element.Tag" 323 | ] 324 | }, 325 | "execution_count": 12, 326 | "metadata": {}, 327 | "output_type": "execute_result" 328 | } 329 | ], 330 | "source": [ 331 | "# タグの情報を取得する\n", 332 | "div = soup.find('div', class_='readingContent01')\n", 333 | "type(div) # データの型はTag型" 334 | ] 335 | }, 336 | { 337 | "cell_type": "code", 338 | "execution_count": 13, 339 | "metadata": {}, 340 | "outputs": [ 341 | { 342 | "data": { 343 | "text/plain": [ 344 | "'div'" 345 | ] 346 | }, 347 | "execution_count": 13, 348 | "metadata": {}, 349 | "output_type": "execute_result" 350 | } 351 | ], 352 | "source": [ 353 | "div.name" 354 | ] 355 | }, 356 | { 357 | "cell_type": "code", 358 | "execution_count": 14, 359 | "metadata": {}, 360 | "outputs": [ 361 | { 362 | "data": { 363 | "text/plain": [ 364 | "['readingContent01']" 365 | ] 366 | }, 367 | "execution_count": 14, 368 | "metadata": {}, 369 | "output_type": "execute_result" 370 | } 371 | ], 372 | "source": [ 373 | "div['class']" 374 | ] 375 | }, 376 | { 377 | "cell_type": "code", 378 | "execution_count": 15, 379 | "metadata": {}, 380 | "outputs": [ 381 | { 382 | "data": { 383 | "text/plain": [ 384 | "{'class': ['readingContent01']}" 385 | ] 386 | }, 387 | "execution_count": 15, 388 | "metadata": {}, 389 | "output_type": "execute_result" 390 | } 391 | ], 392 | "source": [ 393 | "div.attrs # 全属性を取得" 394 | ] 395 | }, 396 | { 397 | "cell_type": "code", 398 | "execution_count": 16, 399 | "metadata": {}, 400 | "outputs": [ 401 | { 402 | "data": { 403 | "text/plain": [ 404 | "131" 405 | ] 406 | }, 407 | "execution_count": 16, 408 | "metadata": {}, 409 | "output_type": "execute_result" 410 | } 411 | ], 412 | "source": [ 413 | "# さまざまな検索方法\n", 414 | "a_tags = soup.find_all('a') # タグ名を指定\n", 415 | "len(a_tags)" 416 | ] 417 | }, 418 | { 419 | "cell_type": "code", 420 | "execution_count": 17, 421 | "metadata": {}, 422 | "outputs": [ 423 | { 424 | "name": "stdout", 425 | "output_type": "stream", 426 | "text": [ 427 | "base\n", 428 | "body\n", 429 | "br\n", 430 | "br\n", 431 | "br\n", 432 | "br\n", 433 | "br\n" 434 | ] 435 | } 436 | ], 437 | "source": [ 438 | "import re\n", 439 | "for tag in soup.find_all(re.compile('^b')): # 正規表現で指定\n", 440 | " print(tag.name)" 441 | ] 442 | }, 443 | { 444 | "cell_type": "code", 445 | "execution_count": 18, 446 | "metadata": {}, 447 | "outputs": [ 448 | { 449 | "name": "stdout", 450 | "output_type": "stream", 451 | "text": [ 452 | "html\n", 453 | "title\n" 454 | ] 455 | } 456 | ], 457 | "source": [ 458 | "for tag in soup.find_all(['html', 'title']): # リストで指定\n", 459 | " print(tag.name)" 460 | ] 461 | }, 462 | { 463 | "cell_type": "code", 464 | "execution_count": 19, 465 | "metadata": {}, 466 | "outputs": [ 467 | { 468 | "data": { 469 | "text/plain": [ 470 | "('div', {'class': ['headCategoryNavigation'], 'id': 'categoryNavigation'})" 471 | ] 472 | }, 473 | "execution_count": 19, 474 | "metadata": {}, 475 | "output_type": "execute_result" 476 | } 477 | ], 478 | "source": [ 479 | "# キーワード引数での属性指定\n", 480 | "tag = soup.find(id='categoryNavigation') # id属性を指定して検索\n", 481 | "tag.name, tag.attrs" 482 | ] 483 | }, 484 | { 485 | "cell_type": "code", 486 | "execution_count": 20, 487 | "metadata": {}, 488 | "outputs": [ 489 | { 490 | "data": { 491 | "text/plain": [ 492 | "57" 493 | ] 494 | }, 495 | "execution_count": 20, 496 | "metadata": {}, 497 | "output_type": "execute_result" 498 | } 499 | ], 500 | "source": [ 501 | "tags = soup.find_all(id=True) # id属性があるタグを全て検索\n", 502 | "len(tags)" 503 | ] 504 | }, 505 | { 506 | "cell_type": "code", 507 | "execution_count": 21, 508 | "metadata": {}, 509 | "outputs": [ 510 | { 511 | "data": { 512 | "text/plain": [ 513 | "{'class': ['readingContent01']}" 514 | ] 515 | }, 516 | "execution_count": 21, 517 | "metadata": {}, 518 | "output_type": "execute_result" 519 | } 520 | ], 521 | "source": [ 522 | "div = soup.find('div', class_='readingContent01') # class属性はclass_と指定する\n", 523 | "div.attrs" 524 | ] 525 | }, 526 | { 527 | "cell_type": "code", 528 | "execution_count": 22, 529 | "metadata": {}, 530 | "outputs": [ 531 | { 532 | "data": { 533 | "text/plain": [ 534 | "{'class': ['readingContent01']}" 535 | ] 536 | }, 537 | "execution_count": 22, 538 | "metadata": {}, 539 | "output_type": "execute_result" 540 | } 541 | ], 542 | "source": [ 543 | "div = soup.find('div', {'class': 'readingContent01'}) # 辞書形式でも指定できる\n", 544 | "div.attrs" 545 | ] 546 | }, 547 | { 548 | "cell_type": "code", 549 | "execution_count": 23, 550 | "metadata": {}, 551 | "outputs": [ 552 | { 553 | "data": { 554 | "text/plain": [ 555 | "[技評ねこ部通信|gihyo.jp … 技術評論社]" 556 | ] 557 | }, 558 | "execution_count": 23, 559 | "metadata": {}, 560 | "output_type": "execute_result" 561 | } 562 | ], 563 | "source": [ 564 | "# CSSセレクターを使用した検索\n", 565 | "soup.select('title') # タグ名を指定" 566 | ] 567 | }, 568 | { 569 | "cell_type": "code", 570 | "execution_count": 24, 571 | "metadata": {}, 572 | "outputs": [ 573 | { 574 | "data": { 575 | "text/plain": [ 576 | "131" 577 | ] 578 | }, 579 | "execution_count": 24, 580 | "metadata": {}, 581 | "output_type": "execute_result" 582 | } 583 | ], 584 | "source": [ 585 | "tags = soup.select('body a') # body タグの下のaタグ\n", 586 | "len(a_tags)" 587 | ] 588 | }, 589 | { 590 | "cell_type": "code", 591 | "execution_count": 25, 592 | "metadata": {}, 593 | "outputs": [ 594 | { 595 | "data": { 596 | "text/plain": [ 597 | "9" 598 | ] 599 | }, 600 | "execution_count": 25, 601 | "metadata": {}, 602 | "output_type": "execute_result" 603 | } 604 | ], 605 | "source": [ 606 | "a_tags = soup.select('p > a') # pタグの直下のaタグ\n", 607 | "len(a_tags)" 608 | ] 609 | }, 610 | { 611 | "cell_type": "code", 612 | "execution_count": 26, 613 | "metadata": {}, 614 | "outputs": [ 615 | { 616 | "data": { 617 | "text/plain": [ 618 | "[]" 619 | ] 620 | }, 621 | "execution_count": 26, 622 | "metadata": {}, 623 | "output_type": "execute_result" 624 | } 625 | ], 626 | "source": [ 627 | "soup.select('body > a') # bodyタグの直下のaタグは存在しない" 628 | ] 629 | }, 630 | { 631 | "cell_type": "code", 632 | "execution_count": 27, 633 | "metadata": { 634 | "collapsed": true 635 | }, 636 | "outputs": [], 637 | "source": [ 638 | "div = soup.select('.readingContent01') # classを指定\n", 639 | "div = soup.select('div.readingContent01')\n", 640 | "div = soup.select('#categoryNavigation') # idを指定\n", 641 | "div = soup.select('div#categoryNavigation')\n", 642 | "a_tag = soup.select_one('div > a') # 最初のdivタグ直下のaタグを返す" 643 | ] 644 | } 645 | ], 646 | "metadata": { 647 | "kernelspec": { 648 | "display_name": "Python 3", 649 | "language": "python", 650 | "name": "python3" 651 | }, 652 | "language_info": { 653 | "codemirror_mode": { 654 | "name": "ipython", 655 | "version": 3 656 | }, 657 | "file_extension": ".py", 658 | "mimetype": "text/x-python", 659 | "name": "python", 660 | "nbconvert_exporter": "python", 661 | "pygments_lexer": "ipython3", 662 | "version": "3.6.2" 663 | } 664 | }, 665 | "nbformat": 4, 666 | "nbformat_minor": 2 667 | } 668 | -------------------------------------------------------------------------------- /2_guide/2_3.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "## リスト" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 1, 13 | "metadata": {}, 14 | "outputs": [ 15 | { 16 | "data": { 17 | "text/plain": [ 18 | "['spam', 'egg', 0.5]" 19 | ] 20 | }, 21 | "execution_count": 1, 22 | "metadata": {}, 23 | "output_type": "execute_result" 24 | } 25 | ], 26 | "source": [ 27 | "['spam', 'egg', 0.5]" 28 | ] 29 | }, 30 | { 31 | "cell_type": "code", 32 | "execution_count": 2, 33 | "metadata": {}, 34 | "outputs": [ 35 | { 36 | "data": { 37 | "text/plain": [ 38 | "['spam', 'ham', 'egg']" 39 | ] 40 | }, 41 | "execution_count": 2, 42 | "metadata": {}, 43 | "output_type": "execute_result" 44 | } 45 | ], 46 | "source": [ 47 | "['spam', 'ham'] + ['egg']" 48 | ] 49 | }, 50 | { 51 | "cell_type": "code", 52 | "execution_count": 3, 53 | "metadata": {}, 54 | "outputs": [ 55 | { 56 | "data": { 57 | "text/plain": [ 58 | "['spam', 'spam', 'spam', 'spam', 'spam']" 59 | ] 60 | }, 61 | "execution_count": 3, 62 | "metadata": {}, 63 | "output_type": "execute_result" 64 | } 65 | ], 66 | "source": [ 67 | "['spam'] * 5" 68 | ] 69 | }, 70 | { 71 | "cell_type": "code", 72 | "execution_count": 4, 73 | "metadata": {}, 74 | "outputs": [ 75 | { 76 | "data": { 77 | "text/plain": [ 78 | "'spam'" 79 | ] 80 | }, 81 | "execution_count": 4, 82 | "metadata": {}, 83 | "output_type": "execute_result" 84 | } 85 | ], 86 | "source": [ 87 | "['spam', 'ham', 'egg'][0]" 88 | ] 89 | }, 90 | { 91 | "cell_type": "code", 92 | "execution_count": 5, 93 | "metadata": {}, 94 | "outputs": [ 95 | { 96 | "data": { 97 | "text/plain": [ 98 | "['ham', 'egg']" 99 | ] 100 | }, 101 | "execution_count": 5, 102 | "metadata": {}, 103 | "output_type": "execute_result" 104 | } 105 | ], 106 | "source": [ 107 | "['spam', 'ham', 'egg'][1:]" 108 | ] 109 | }, 110 | { 111 | "cell_type": "code", 112 | "execution_count": 6, 113 | "metadata": {}, 114 | "outputs": [ 115 | { 116 | "data": { 117 | "text/plain": [ 118 | "3" 119 | ] 120 | }, 121 | "execution_count": 6, 122 | "metadata": {}, 123 | "output_type": "execute_result" 124 | } 125 | ], 126 | "source": [ 127 | "len(['spam', 'ham', 'egg'])" 128 | ] 129 | }, 130 | { 131 | "cell_type": "code", 132 | "execution_count": 7, 133 | "metadata": {}, 134 | "outputs": [ 135 | { 136 | "data": { 137 | "text/plain": [ 138 | "True" 139 | ] 140 | }, 141 | "execution_count": 7, 142 | "metadata": {}, 143 | "output_type": "execute_result" 144 | } 145 | ], 146 | "source": [ 147 | "'ham' in ['spam', 'ham', 'egg']" 148 | ] 149 | }, 150 | { 151 | "cell_type": "code", 152 | "execution_count": 8, 153 | "metadata": {}, 154 | "outputs": [ 155 | { 156 | "name": "stdout", 157 | "output_type": "stream", 158 | "text": [ 159 | "cat\n", 160 | "dog\n", 161 | "snake\n" 162 | ] 163 | } 164 | ], 165 | "source": [ 166 | "for animal in ['cat', 'dog', 'snake']:\n", 167 | " print(animal)" 168 | ] 169 | }, 170 | { 171 | "cell_type": "code", 172 | "execution_count": 9, 173 | "metadata": { 174 | "collapsed": true 175 | }, 176 | "outputs": [], 177 | "source": [ 178 | "animals = ['cat', 'dog', 'snake']" 179 | ] 180 | }, 181 | { 182 | "cell_type": "code", 183 | "execution_count": 10, 184 | "metadata": { 185 | "collapsed": true 186 | }, 187 | "outputs": [], 188 | "source": [ 189 | "animals.append('elephant')" 190 | ] 191 | }, 192 | { 193 | "cell_type": "code", 194 | "execution_count": 11, 195 | "metadata": {}, 196 | "outputs": [ 197 | { 198 | "data": { 199 | "text/plain": [ 200 | "['cat', 'dog', 'snake', 'elephant']" 201 | ] 202 | }, 203 | "execution_count": 11, 204 | "metadata": {}, 205 | "output_type": "execute_result" 206 | } 207 | ], 208 | "source": [ 209 | "animals" 210 | ] 211 | }, 212 | { 213 | "cell_type": "code", 214 | "execution_count": 12, 215 | "metadata": { 216 | "collapsed": true 217 | }, 218 | "outputs": [], 219 | "source": [ 220 | "ret = []" 221 | ] 222 | }, 223 | { 224 | "cell_type": "code", 225 | "execution_count": 13, 226 | "metadata": { 227 | "collapsed": true 228 | }, 229 | "outputs": [], 230 | "source": [ 231 | "for animal in animals:\n", 232 | " ret.append(len(animal))" 233 | ] 234 | }, 235 | { 236 | "cell_type": "code", 237 | "execution_count": 14, 238 | "metadata": {}, 239 | "outputs": [ 240 | { 241 | "data": { 242 | "text/plain": [ 243 | "[3, 3, 5, 8]" 244 | ] 245 | }, 246 | "execution_count": 14, 247 | "metadata": {}, 248 | "output_type": "execute_result" 249 | } 250 | ], 251 | "source": [ 252 | "ret" 253 | ] 254 | }, 255 | { 256 | "cell_type": "code", 257 | "execution_count": 15, 258 | "metadata": {}, 259 | "outputs": [ 260 | { 261 | "data": { 262 | "text/plain": [ 263 | "[3, 3, 5, 8]" 264 | ] 265 | }, 266 | "execution_count": 15, 267 | "metadata": {}, 268 | "output_type": "execute_result" 269 | } 270 | ], 271 | "source": [ 272 | "[len(animal) for animal in animals]" 273 | ] 274 | }, 275 | { 276 | "cell_type": "code", 277 | "execution_count": 16, 278 | "metadata": { 279 | "collapsed": true 280 | }, 281 | "outputs": [], 282 | "source": [ 283 | "dog, cat = ['dog', 'cat']" 284 | ] 285 | }, 286 | { 287 | "cell_type": "code", 288 | "execution_count": 17, 289 | "metadata": {}, 290 | "outputs": [ 291 | { 292 | "data": { 293 | "text/plain": [ 294 | "'dog'" 295 | ] 296 | }, 297 | "execution_count": 17, 298 | "metadata": {}, 299 | "output_type": "execute_result" 300 | } 301 | ], 302 | "source": [ 303 | "dog" 304 | ] 305 | }, 306 | { 307 | "cell_type": "code", 308 | "execution_count": 18, 309 | "metadata": {}, 310 | "outputs": [ 311 | { 312 | "data": { 313 | "text/plain": [ 314 | "'cat'" 315 | ] 316 | }, 317 | "execution_count": 18, 318 | "metadata": {}, 319 | "output_type": "execute_result" 320 | } 321 | ], 322 | "source": [ 323 | "cat" 324 | ] 325 | }, 326 | { 327 | "cell_type": "markdown", 328 | "metadata": {}, 329 | "source": [ 330 | "## タプル" 331 | ] 332 | }, 333 | { 334 | "cell_type": "code", 335 | "execution_count": 19, 336 | "metadata": {}, 337 | "outputs": [ 338 | { 339 | "data": { 340 | "text/plain": [ 341 | "('spam', 'ham', 4)" 342 | ] 343 | }, 344 | "execution_count": 19, 345 | "metadata": {}, 346 | "output_type": "execute_result" 347 | } 348 | ], 349 | "source": [ 350 | "('spam', 'ham', 4)" 351 | ] 352 | }, 353 | { 354 | "cell_type": "code", 355 | "execution_count": 20, 356 | "metadata": {}, 357 | "outputs": [ 358 | { 359 | "data": { 360 | "text/plain": [ 361 | "('spam', 'ham', 'egg')" 362 | ] 363 | }, 364 | "execution_count": 20, 365 | "metadata": {}, 366 | "output_type": "execute_result" 367 | } 368 | ], 369 | "source": [ 370 | "('spam', 'ham') + ('egg',)" 371 | ] 372 | }, 373 | { 374 | "cell_type": "code", 375 | "execution_count": 21, 376 | "metadata": {}, 377 | "outputs": [ 378 | { 379 | "data": { 380 | "text/plain": [ 381 | "('spam', 'spam', 'spam', 'spam', 'spam')" 382 | ] 383 | }, 384 | "execution_count": 21, 385 | "metadata": {}, 386 | "output_type": "execute_result" 387 | } 388 | ], 389 | "source": [ 390 | "('spam',) * 5" 391 | ] 392 | }, 393 | { 394 | "cell_type": "code", 395 | "execution_count": 22, 396 | "metadata": {}, 397 | "outputs": [ 398 | { 399 | "data": { 400 | "text/plain": [ 401 | "'spam'" 402 | ] 403 | }, 404 | "execution_count": 22, 405 | "metadata": {}, 406 | "output_type": "execute_result" 407 | } 408 | ], 409 | "source": [ 410 | "('spam', 'ham', 'egg')[0]" 411 | ] 412 | }, 413 | { 414 | "cell_type": "code", 415 | "execution_count": 23, 416 | "metadata": {}, 417 | "outputs": [ 418 | { 419 | "data": { 420 | "text/plain": [ 421 | "('ham', 'egg')" 422 | ] 423 | }, 424 | "execution_count": 23, 425 | "metadata": {}, 426 | "output_type": "execute_result" 427 | } 428 | ], 429 | "source": [ 430 | "('spam', 'ham', 'egg')[1:]" 431 | ] 432 | }, 433 | { 434 | "cell_type": "code", 435 | "execution_count": 24, 436 | "metadata": {}, 437 | "outputs": [ 438 | { 439 | "data": { 440 | "text/plain": [ 441 | "3" 442 | ] 443 | }, 444 | "execution_count": 24, 445 | "metadata": {}, 446 | "output_type": "execute_result" 447 | } 448 | ], 449 | "source": [ 450 | "len(('spam', 'ham', 'egg'))" 451 | ] 452 | }, 453 | { 454 | "cell_type": "code", 455 | "execution_count": 25, 456 | "metadata": {}, 457 | "outputs": [ 458 | { 459 | "data": { 460 | "text/plain": [ 461 | "True" 462 | ] 463 | }, 464 | "execution_count": 25, 465 | "metadata": {}, 466 | "output_type": "execute_result" 467 | } 468 | ], 469 | "source": [ 470 | "'ham' in ('spam', 'ham', 'egg')" 471 | ] 472 | }, 473 | { 474 | "cell_type": "code", 475 | "execution_count": 26, 476 | "metadata": {}, 477 | "outputs": [ 478 | { 479 | "data": { 480 | "text/plain": [ 481 | "('spam',)" 482 | ] 483 | }, 484 | "execution_count": 26, 485 | "metadata": {}, 486 | "output_type": "execute_result" 487 | } 488 | ], 489 | "source": [ 490 | "('spam',)" 491 | ] 492 | }, 493 | { 494 | "cell_type": "code", 495 | "execution_count": 27, 496 | "metadata": {}, 497 | "outputs": [ 498 | { 499 | "data": { 500 | "text/plain": [ 501 | "'spam'" 502 | ] 503 | }, 504 | "execution_count": 27, 505 | "metadata": {}, 506 | "output_type": "execute_result" 507 | } 508 | ], 509 | "source": [ 510 | "('spam')" 511 | ] 512 | }, 513 | { 514 | "cell_type": "code", 515 | "execution_count": 28, 516 | "metadata": {}, 517 | "outputs": [ 518 | { 519 | "data": { 520 | "text/plain": [ 521 | "('dog', 'cat')" 522 | ] 523 | }, 524 | "execution_count": 28, 525 | "metadata": {}, 526 | "output_type": "execute_result" 527 | } 528 | ], 529 | "source": [ 530 | "'dog', 'cat'" 531 | ] 532 | }, 533 | { 534 | "cell_type": "code", 535 | "execution_count": 29, 536 | "metadata": { 537 | "collapsed": true 538 | }, 539 | "outputs": [], 540 | "source": [ 541 | "def head_splitter(seq):\n", 542 | " return seq[0], seq[1:]\n" 543 | ] 544 | }, 545 | { 546 | "cell_type": "code", 547 | "execution_count": 30, 548 | "metadata": { 549 | "collapsed": true 550 | }, 551 | "outputs": [], 552 | "source": [ 553 | "head, tail = head_splitter(['head', 'body', 'tail'])" 554 | ] 555 | }, 556 | { 557 | "cell_type": "code", 558 | "execution_count": 31, 559 | "metadata": {}, 560 | "outputs": [ 561 | { 562 | "data": { 563 | "text/plain": [ 564 | "'head'" 565 | ] 566 | }, 567 | "execution_count": 31, 568 | "metadata": {}, 569 | "output_type": "execute_result" 570 | } 571 | ], 572 | "source": [ 573 | "head" 574 | ] 575 | }, 576 | { 577 | "cell_type": "code", 578 | "execution_count": 32, 579 | "metadata": {}, 580 | "outputs": [ 581 | { 582 | "data": { 583 | "text/plain": [ 584 | "['body', 'tail']" 585 | ] 586 | }, 587 | "execution_count": 32, 588 | "metadata": {}, 589 | "output_type": "execute_result" 590 | } 591 | ], 592 | "source": [ 593 | "tail" 594 | ] 595 | }, 596 | { 597 | "cell_type": "code", 598 | "execution_count": 33, 599 | "metadata": { 600 | "collapsed": true 601 | }, 602 | "outputs": [], 603 | "source": [ 604 | "def bad_implementation():\n", 605 | " return 'username', 'user_password', 'user_id', 'user_permission'\n" 606 | ] 607 | }, 608 | { 609 | "cell_type": "code", 610 | "execution_count": 34, 611 | "metadata": { 612 | "collapsed": true 613 | }, 614 | "outputs": [], 615 | "source": [ 616 | "username, user_password, user_id, user_permission = bad_implementation()" 617 | ] 618 | }, 619 | { 620 | "cell_type": "markdown", 621 | "metadata": {}, 622 | "source": [ 623 | "## 辞書" 624 | ] 625 | }, 626 | { 627 | "cell_type": "code", 628 | "execution_count": 35, 629 | "metadata": { 630 | "collapsed": true 631 | }, 632 | "outputs": [], 633 | "source": [ 634 | "user_info = {'user_name': 'hirokiky', 'last_name': 'Kiyohara'}" 635 | ] 636 | }, 637 | { 638 | "cell_type": "code", 639 | "execution_count": 36, 640 | "metadata": {}, 641 | "outputs": [ 642 | { 643 | "data": { 644 | "text/plain": [ 645 | "{'last_name': 'Kiyohara', 'user_name': 'hirokiky'}" 646 | ] 647 | }, 648 | "execution_count": 36, 649 | "metadata": {}, 650 | "output_type": "execute_result" 651 | } 652 | ], 653 | "source": [ 654 | "user_info" 655 | ] 656 | }, 657 | { 658 | "cell_type": "code", 659 | "execution_count": 37, 660 | "metadata": {}, 661 | "outputs": [ 662 | { 663 | "data": { 664 | "text/plain": [ 665 | "'hirokiky'" 666 | ] 667 | }, 668 | "execution_count": 37, 669 | "metadata": {}, 670 | "output_type": "execute_result" 671 | } 672 | ], 673 | "source": [ 674 | "user_info['user_name']" 675 | ] 676 | }, 677 | { 678 | "cell_type": "code", 679 | "execution_count": 38, 680 | "metadata": { 681 | "collapsed": true 682 | }, 683 | "outputs": [], 684 | "source": [ 685 | "user_info['first_name'] = 'Hiroki'" 686 | ] 687 | }, 688 | { 689 | "cell_type": "code", 690 | "execution_count": 39, 691 | "metadata": {}, 692 | "outputs": [ 693 | { 694 | "data": { 695 | "text/plain": [ 696 | "{'first_name': 'Hiroki', 'last_name': 'Kiyohara', 'user_name': 'hirokiky'}" 697 | ] 698 | }, 699 | "execution_count": 39, 700 | "metadata": {}, 701 | "output_type": "execute_result" 702 | } 703 | ], 704 | "source": [ 705 | "user_info" 706 | ] 707 | }, 708 | { 709 | "cell_type": "code", 710 | "execution_count": 40, 711 | "metadata": {}, 712 | "outputs": [ 713 | { 714 | "data": { 715 | "text/plain": [ 716 | "True" 717 | ] 718 | }, 719 | "execution_count": 40, 720 | "metadata": {}, 721 | "output_type": "execute_result" 722 | } 723 | ], 724 | "source": [ 725 | "'user_name' in user_info" 726 | ] 727 | }, 728 | { 729 | "cell_type": "code", 730 | "execution_count": 41, 731 | "metadata": {}, 732 | "outputs": [ 733 | { 734 | "data": { 735 | "text/plain": [ 736 | "False" 737 | ] 738 | }, 739 | "execution_count": 41, 740 | "metadata": {}, 741 | "output_type": "execute_result" 742 | } 743 | ], 744 | "source": [ 745 | "'bio' in user_info" 746 | ] 747 | }, 748 | { 749 | "cell_type": "code", 750 | "execution_count": 42, 751 | "metadata": {}, 752 | "outputs": [ 753 | { 754 | "ename": "KeyError", 755 | "evalue": "'bio'", 756 | "output_type": "error", 757 | "traceback": [ 758 | "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", 759 | "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", 760 | "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0muser_info\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'bio'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", 761 | "\u001b[0;31mKeyError\u001b[0m: 'bio'" 762 | ] 763 | } 764 | ], 765 | "source": [ 766 | "user_info['bio']" 767 | ] 768 | }, 769 | { 770 | "cell_type": "code", 771 | "execution_count": 43, 772 | "metadata": {}, 773 | "outputs": [ 774 | { 775 | "data": { 776 | "text/plain": [ 777 | "'hirokiky'" 778 | ] 779 | }, 780 | "execution_count": 43, 781 | "metadata": {}, 782 | "output_type": "execute_result" 783 | } 784 | ], 785 | "source": [ 786 | "user_info.get('user_name')" 787 | ] 788 | }, 789 | { 790 | "cell_type": "code", 791 | "execution_count": 44, 792 | "metadata": { 793 | "collapsed": true 794 | }, 795 | "outputs": [], 796 | "source": [ 797 | "bio = user_info.get('bio')" 798 | ] 799 | }, 800 | { 801 | "cell_type": "code", 802 | "execution_count": 45, 803 | "metadata": {}, 804 | "outputs": [ 805 | { 806 | "name": "stdout", 807 | "output_type": "stream", 808 | "text": [ 809 | "None\n" 810 | ] 811 | } 812 | ], 813 | "source": [ 814 | "print(bio)" 815 | ] 816 | }, 817 | { 818 | "cell_type": "code", 819 | "execution_count": 46, 820 | "metadata": {}, 821 | "outputs": [ 822 | { 823 | "data": { 824 | "text/plain": [ 825 | "''" 826 | ] 827 | }, 828 | "execution_count": 46, 829 | "metadata": {}, 830 | "output_type": "execute_result" 831 | } 832 | ], 833 | "source": [ 834 | "user_info.get('bio', '')" 835 | ] 836 | }, 837 | { 838 | "cell_type": "code", 839 | "execution_count": 47, 840 | "metadata": { 841 | "collapsed": true 842 | }, 843 | "outputs": [], 844 | "source": [ 845 | "d = {'foo': 'spam', 'bar': 'ham'}" 846 | ] 847 | }, 848 | { 849 | "cell_type": "code", 850 | "execution_count": 48, 851 | "metadata": {}, 852 | "outputs": [ 853 | { 854 | "data": { 855 | "text/plain": [ 856 | "dict_items([('foo', 'spam'), ('bar', 'ham')])" 857 | ] 858 | }, 859 | "execution_count": 48, 860 | "metadata": {}, 861 | "output_type": "execute_result" 862 | } 863 | ], 864 | "source": [ 865 | "d.items()" 866 | ] 867 | }, 868 | { 869 | "cell_type": "code", 870 | "execution_count": 49, 871 | "metadata": { 872 | "collapsed": true 873 | }, 874 | "outputs": [], 875 | "source": [ 876 | "d = {'foo': 'spam', 'bar': 'ham'}" 877 | ] 878 | }, 879 | { 880 | "cell_type": "code", 881 | "execution_count": 50, 882 | "metadata": {}, 883 | "outputs": [ 884 | { 885 | "name": "stdout", 886 | "output_type": "stream", 887 | "text": [ 888 | "foo spam\n", 889 | "bar ham\n" 890 | ] 891 | } 892 | ], 893 | "source": [ 894 | "for key, value in d.items():\n", 895 | " print(key, value)\n" 896 | ] 897 | }, 898 | { 899 | "cell_type": "markdown", 900 | "metadata": {}, 901 | "source": [ 902 | "## 集合" 903 | ] 904 | }, 905 | { 906 | "cell_type": "code", 907 | "execution_count": 51, 908 | "metadata": {}, 909 | "outputs": [ 910 | { 911 | "data": { 912 | "text/plain": [ 913 | "{'ham', 'spam'}" 914 | ] 915 | }, 916 | "execution_count": 51, 917 | "metadata": {}, 918 | "output_type": "execute_result" 919 | } 920 | ], 921 | "source": [ 922 | "{'spam', 'ham'}" 923 | ] 924 | }, 925 | { 926 | "cell_type": "code", 927 | "execution_count": 52, 928 | "metadata": {}, 929 | "outputs": [ 930 | { 931 | "data": { 932 | "text/plain": [ 933 | "{'spam'}" 934 | ] 935 | }, 936 | "execution_count": 52, 937 | "metadata": {}, 938 | "output_type": "execute_result" 939 | } 940 | ], 941 | "source": [ 942 | "{'spam', 'spam', 'spam'}" 943 | ] 944 | }, 945 | { 946 | "cell_type": "code", 947 | "execution_count": 53, 948 | "metadata": { 949 | "collapsed": true 950 | }, 951 | "outputs": [], 952 | "source": [ 953 | "unique_users = {'dog', 'cat'}" 954 | ] 955 | }, 956 | { 957 | "cell_type": "code", 958 | "execution_count": 54, 959 | "metadata": { 960 | "collapsed": true 961 | }, 962 | "outputs": [], 963 | "source": [ 964 | "unique_users.add('snake')" 965 | ] 966 | }, 967 | { 968 | "cell_type": "code", 969 | "execution_count": 55, 970 | "metadata": {}, 971 | "outputs": [ 972 | { 973 | "data": { 974 | "text/plain": [ 975 | "{'cat', 'dog', 'snake'}" 976 | ] 977 | }, 978 | "execution_count": 55, 979 | "metadata": {}, 980 | "output_type": "execute_result" 981 | } 982 | ], 983 | "source": [ 984 | "unique_users" 985 | ] 986 | }, 987 | { 988 | "cell_type": "code", 989 | "execution_count": 56, 990 | "metadata": {}, 991 | "outputs": [ 992 | { 993 | "data": { 994 | "text/plain": [ 995 | "3" 996 | ] 997 | }, 998 | "execution_count": 56, 999 | "metadata": {}, 1000 | "output_type": "execute_result" 1001 | } 1002 | ], 1003 | "source": [ 1004 | "len(unique_users)" 1005 | ] 1006 | }, 1007 | { 1008 | "cell_type": "code", 1009 | "execution_count": 57, 1010 | "metadata": { 1011 | "collapsed": true 1012 | }, 1013 | "outputs": [], 1014 | "source": [ 1015 | "unique_users.add('snake')" 1016 | ] 1017 | }, 1018 | { 1019 | "cell_type": "code", 1020 | "execution_count": 58, 1021 | "metadata": { 1022 | "collapsed": true 1023 | }, 1024 | "outputs": [], 1025 | "source": [ 1026 | "unique_users.add('snake')" 1027 | ] 1028 | }, 1029 | { 1030 | "cell_type": "code", 1031 | "execution_count": 59, 1032 | "metadata": { 1033 | "collapsed": true 1034 | }, 1035 | "outputs": [], 1036 | "source": [ 1037 | "unique_users.add('snake')" 1038 | ] 1039 | }, 1040 | { 1041 | "cell_type": "code", 1042 | "execution_count": 60, 1043 | "metadata": {}, 1044 | "outputs": [ 1045 | { 1046 | "data": { 1047 | "text/plain": [ 1048 | "3" 1049 | ] 1050 | }, 1051 | "execution_count": 60, 1052 | "metadata": {}, 1053 | "output_type": "execute_result" 1054 | } 1055 | ], 1056 | "source": [ 1057 | "len(unique_users)" 1058 | ] 1059 | }, 1060 | { 1061 | "cell_type": "code", 1062 | "execution_count": 61, 1063 | "metadata": { 1064 | "collapsed": true 1065 | }, 1066 | "outputs": [], 1067 | "source": [ 1068 | "allowed_permissions = {'edit', 'view'}" 1069 | ] 1070 | }, 1071 | { 1072 | "cell_type": "code", 1073 | "execution_count": 62, 1074 | "metadata": { 1075 | "collapsed": true 1076 | }, 1077 | "outputs": [], 1078 | "source": [ 1079 | "requested_permissions = {'view', 'delete'}" 1080 | ] 1081 | }, 1082 | { 1083 | "cell_type": "code", 1084 | "execution_count": 63, 1085 | "metadata": {}, 1086 | "outputs": [ 1087 | { 1088 | "data": { 1089 | "text/plain": [ 1090 | "{'view'}" 1091 | ] 1092 | }, 1093 | "execution_count": 63, 1094 | "metadata": {}, 1095 | "output_type": "execute_result" 1096 | } 1097 | ], 1098 | "source": [ 1099 | "allowed_permissions & requested_permissions" 1100 | ] 1101 | }, 1102 | { 1103 | "cell_type": "code", 1104 | "execution_count": 64, 1105 | "metadata": { 1106 | "collapsed": true 1107 | }, 1108 | "outputs": [], 1109 | "source": [ 1110 | "editor = {'edit', 'comment'}" 1111 | ] 1112 | }, 1113 | { 1114 | "cell_type": "code", 1115 | "execution_count": 65, 1116 | "metadata": { 1117 | "collapsed": true 1118 | }, 1119 | "outputs": [], 1120 | "source": [ 1121 | "reviewer = {'comment', 'approve'}" 1122 | ] 1123 | }, 1124 | { 1125 | "cell_type": "code", 1126 | "execution_count": 66, 1127 | "metadata": {}, 1128 | "outputs": [ 1129 | { 1130 | "data": { 1131 | "text/plain": [ 1132 | "{'approve', 'comment', 'edit'}" 1133 | ] 1134 | }, 1135 | "execution_count": 66, 1136 | "metadata": {}, 1137 | "output_type": "execute_result" 1138 | } 1139 | ], 1140 | "source": [ 1141 | "editor | reviewer" 1142 | ] 1143 | } 1144 | ], 1145 | "metadata": { 1146 | "kernelspec": { 1147 | "display_name": "Python 3", 1148 | "language": "python", 1149 | "name": "python3" 1150 | }, 1151 | "language_info": { 1152 | "codemirror_mode": { 1153 | "name": "ipython", 1154 | "version": 3 1155 | }, 1156 | "file_extension": ".py", 1157 | "mimetype": "text/x-python", 1158 | "name": "python", 1159 | "nbconvert_exporter": "python", 1160 | "pygments_lexer": "ipython3", 1161 | "version": "3.6.1" 1162 | } 1163 | }, 1164 | "nbformat": 4, 1165 | "nbformat_minor": 2 1166 | } 1167 | -------------------------------------------------------------------------------- /4_scraping/lego_scraper/brickset2017.csv: -------------------------------------------------------------------------------- 1 | number,name,image,theme,subtheme,year,rating,pieces,minifigs,us_price,eu_price,owner,want_it 2 | 10255,Assembly Square,https://images.brickset.com/sets/small/10255-1.jpg,Advanced Models,Modular Buildings,2017,5.0,4002,9,279.99,239.99,2820,4727 3 | 10257,Carousel,https://images.brickset.com/sets/small/10257-1.jpg,Advanced Models,Fairground,2017,,2670,,199.99,179.99,, 4 | 10703,Creative Builder Box,https://images.brickset.com/sets/small/10703-1.jpg,Classic,,2017,,502,,,24.99,225,346 5 | 10704,Creative Box,https://images.brickset.com/sets/small/10704-1.jpg,Classic,,2017,,900,,,34.99,83,198 6 | 10706,Blue Creative Box,https://images.brickset.com/sets/small/10706-1.jpg,Classic,,2017,4.0,78,,4.99,4.99,520,175 7 | 10707,Red Creative Box,https://images.brickset.com/sets/small/10707-1.jpg,Classic,,2017,,55,,4.99,4.99,427,154 8 | 10708,Green Creative Box,https://images.brickset.com/sets/small/10708-1.jpg,Classic,,2017,,66,,4.99,4.99,444,177 9 | 10709,Orange Creative Box,https://images.brickset.com/sets/small/10709-1.jpg,Classic,,2017,,60,,4.99,4.99,471,165 10 | 10730,Lightning McQueen Speed Launcher,https://images.brickset.com/sets/small/10730-1.jpg,Juniors,Cars 3,2017,,47,,9.99,,13,167 11 | 10731,Cruz Ramirez Race Simulator,https://images.brickset.com/sets/small/10731-1.jpg,Juniors,Cars 3,2017,,59,,9.99,,9,133 12 | 10732,Guido and Luigi's Pit Stop,https://images.brickset.com/sets/small/10732-1.jpg,Juniors,Cars 3,2017,,75,,9.99,,7,148 13 | 10733,Mater's Junkyard,https://images.brickset.com/sets/small/10733-1.jpg,Juniors,Cars 3,2017,,62,,9.99,,12,164 14 | 10734,Demolition Site,https://images.brickset.com/sets/small/10734-1.jpg,Juniors,City,2017,,175,,29.99,29.99,81,223 15 | 10735,Police Truck Chase,https://images.brickset.com/sets/small/10735-1.jpg,Juniors,City,2017,,90,,19.99,19.99,88,124 16 | 10736,Anna and Elsa's Frozen Playground,https://images.brickset.com/sets/small/10736-1.jpg,Juniors,Disney Princess,2017,,94,,24.99,24.99,124,279 17 | 10737,Batman vs. Mr. Freeze,https://images.brickset.com/sets/small/10737-1.jpg,Juniors,DC Comics Super Heroes,2017,3.0,63,2,14.99,14.99,347,438 18 | 10738,Snow White's Forest Cottage,https://images.brickset.com/sets/small/10738-1.jpg,Juniors,,2017,,67,,,,, 19 | 10739,Shark Attack,,Juniors,Ninjago,2017,,,,,,, 20 | 10740,Fire Patrol Suitcase,https://images.brickset.com/sets/small/10740-1.jpg,Juniors,City,2017,,110,2,19.99,19.99,78,91 21 | 10742,Willy's Butte Speed Training,https://images.brickset.com/sets/small/10742-1.jpg,Juniors,Cars 3,2017,,95,,19.99,,12,143 22 | 10743,Smokey's Garage,https://images.brickset.com/sets/small/10743-1.jpg,Juniors,Cars 3,2017,,116,,19.99,,10,137 23 | 10744,Thunder Hollow Crazy 8 Race,https://images.brickset.com/sets/small/10744-1.jpg,Juniors,Cars 3,2017,,191,,34.99,,8,142 24 | 10745,Florida 500 Race Final,,Juniors,Cars 3,2017,,,,,,, 25 | 10746,Mia's Farm Suitcase,https://images.brickset.com/sets/small/10746-1.jpg,Juniors,Friends,2017,,100,,19.99,19.99,47,108 26 | 10747,Andrea and Stephanie's Beach Holiday,https://images.brickset.com/sets/small/10747-1.jpg,Juniors,Friends,2017,,143,,29.99,29.99,48,134 27 | 10823,Batwing Adventure,https://images.brickset.com/sets/small/10823-1.jpg,Duplo,,2017,,28,,29.99,29.99,36,90 28 | 10832,Birthday Party,https://images.brickset.com/sets/small/10832-1.jpg,Duplo,,2017,,19,3,14.99,14.99,35,36 29 | 10833,Nursery School,https://images.brickset.com/sets/small/10833-1.jpg,Duplo,,2017,,39,3,19.99,19.99,41,42 30 | 10834,Pizzeria,https://images.brickset.com/sets/small/10834-1.jpg,Duplo,,2017,,57,3,29.99,29.99,39,56 31 | 10835,Family House,https://images.brickset.com/sets/small/10835-1.jpg,Duplo,,2017,,69,,39.99,39.99,31,57 32 | 10836,Neighborhood,https://images.brickset.com/sets/small/10836-1.jpg,Duplo,,2017,,98,,59.99,59.99,15,51 33 | 10837,Santa's Winter Holiday,,Duplo,,2017,,,,,,, 34 | 10838,Pets,https://images.brickset.com/sets/small/10838-1.jpg,Duplo,,2017,,15,,9.99,9.99,83,73 35 | 10839,{?},https://images.brickset.com/sets/small/10839-1.jpg,Duplo,,2017,,,,,,, 36 | 10840,{?},https://images.brickset.com/sets/small/10840-1.jpg,Duplo,,2017,,,,,,, 37 | 10841,{?},https://images.brickset.com/sets/small/10841-1.jpg,Duplo,,2017,,,,,,, 38 | 10842,Batcave Challenge,https://images.brickset.com/sets/small/10842-1.jpg,Duplo,Batman,2017,,73,,49.99,49.99,36,76 39 | 10843,{Mickey Mouse in racing car},https://images.brickset.com/sets/small/10843-1.jpg,Duplo,Mickey and the Roadster Racers,2017,,,,,,, 40 | 10844,Minnie Mouse Bow-tique,https://images.brickset.com/sets/small/10844-1.jpg,Duplo,,2017,,,,,,, 41 | 10845,My First Carousel,https://images.brickset.com/sets/small/10845-1.jpg,Duplo,,2017,,24,3,24.99,24.99,49,49 42 | 10846,Flo's Café,https://images.brickset.com/sets/small/10846-1.jpg,Duplo,Cars,2017,,,,39.99,,2,19 43 | 10847,My First Number Train,https://images.brickset.com/sets/small/10847-1.jpg,Duplo,,2017,,23,2,19.99,19.99,48,25 44 | 10848,My First Building Blocks,https://images.brickset.com/sets/small/10848-1.jpg,Duplo,,2017,,80,,,19.99,25,23 45 | 10849,My First Plane,https://images.brickset.com/sets/small/10849-1.jpg,Duplo,,2017,,10,,4.99,4.99,71,17 46 | 10850,My First Birthday Cake,https://images.brickset.com/sets/small/10850-1.jpg,Duplo,,2017,,8,,4.99,4.99,64,23 47 | 10851,My First Bus,https://images.brickset.com/sets/small/10851-1.jpg,Duplo,,2017,,6,,4.99,4.99,76,14 48 | 10852,My First Parrot,https://images.brickset.com/sets/small/10852-1.jpg,Duplo,,2017,,7,,4.99,4.99,59,21 49 | 10853,Abundant Wildlife Creative Building Set,https://images.brickset.com/sets/small/10853-1.jpg,Duplo,,2017,,75,,,24.99,16,25 50 | 10854,Creative Box,https://images.brickset.com/sets/small/10854-1.jpg,Duplo,,2017,,120,,,34.99,9,31 51 | 10855,Cinderella's Magical Castle,https://images.brickset.com/sets/small/10855-1.jpg,Duplo,Disney Princess,2017,,56,,34.99,34.99,23,45 52 | 10856,Mater's Shed,https://images.brickset.com/sets/small/10856-1.jpg,Duplo,Cars,2017,,,,19.99,,2,20 53 | 10857,Piston Cup Race,https://images.brickset.com/sets/small/10857-1.jpg,Duplo,Cars,2017,,,,29.99,,3,19 54 | 10952,{?},,Duplo,,2017,,,,,,, 55 | 11913,Nexo Knights: Build Your Own Adventure parts ,,Nexo Knights,Miscellaneous,2017,,,,,,, 56 | 17101,Creative Toolbox,https://images.brickset.com/sets/small/17101-1.jpg,Boost,,2017,,843,,159.99,159.99,, 57 | 21032,Sydney,https://images.brickset.com/sets/small/21032-1.jpg,Architecture,Skylines,2017,,361,,29.99,29.99,1043,1233 58 | 21033,Chicago,https://images.brickset.com/sets/small/21033-1.jpg,Architecture,Skylines,2017,,444,,39.99,39.99,879,1235 59 | 21034,London,https://images.brickset.com/sets/small/21034-1.jpg,Architecture,Skylines,2017,4.0,468,,39.99,39.99,1423,1549 60 | 21035,Solomon R. Guggenheim Museum,https://images.brickset.com/sets/small/21035-1.jpg,Architecture,Landmark Series,2017,,744,,79.99,69.99,363,1203 61 | 21036,Arc De Triomphe,https://images.brickset.com/sets/small/21036-1.jpg,Architecture,Landmark Series,2017,,386,,39.99,,, 62 | 21129,The Mushroom Island,https://images.brickset.com/sets/small/21129-1.jpg,Minecraft,Minifig-scale,2017,,247,2,19.99,19.99,160,325 63 | 21130,The Nether Railway,https://images.brickset.com/sets/small/21130-1.jpg,Minecraft,Minifig-scale,2017,,387,2,29.99,39.99,154,350 64 | 21131,The Ice Spikes,https://images.brickset.com/sets/small/21131-1.jpg,Minecraft,Minifig-scale,2017,,454,2,39.99,49.99,96,331 65 | 21132,Jungle Temple,https://images.brickset.com/sets/small/21132-1.jpg,Minecraft,Minifig-scale,2017,,598,3,49.99,59.99,69,353 66 | 21133,The Witch Hut,https://images.brickset.com/sets/small/21133-1.jpg,Minecraft,Minifig-scale,2017,,502,2,59.99,69.99,92,366 67 | 21134,The Waterfall Base,https://images.brickset.com/sets/small/21134-1.jpg,Minecraft,Minifig-scale,2017,,729,4,69.99,89.99,89,365 68 | 21135,The Crafting Box 2.0,,Minecraft,Minifig-scale,2017,,,,,,, 69 | 21136,The Ocean Monument,https://images.brickset.com/sets/small/21136-1.jpg,Minecraft,Minifig-scale,2017,,1122,,119.99,,, 70 | 21137,The Mountain Cave,,Minecraft,Minifig-scale,2017,,,,,,, 71 | 21308,Adventure Time,https://images.brickset.com/sets/small/21308-1.jpg,Ideas,Licensed,2017,,495,,49.99,49.99,487,770 72 | 21309,NASA Apollo Saturn V,https://images.brickset.com/sets/small/21309-1.jpg,Ideas,,2017,,1969,,119.99,119.99,, 73 | 30323,My First Fish,https://images.brickset.com/sets/small/30323-1.jpg,Duplo,,2017,,,,,,47,22 74 | 30324,My Town {Random Bag},https://images.brickset.com/sets/small/30324-1.jpg,Duplo,,2017,,,,,,6,15 75 | 30324,My Town - Female,https://images.brickset.com/sets/small/30324-1.jpg,Duplo,,2017,,3,1,,,8,13 76 | 30324,My Town - Policeman,https://images.brickset.com/sets/small/30324-1.jpg,Duplo,,2017,,3,,,,8,14 77 | 30324,My Town - Girl,https://images.brickset.com/sets/small/30324-1.jpg,Duplo,,2017,,3,,,,6,14 78 | 30324,My Town - Cat,https://images.brickset.com/sets/small/30324-1.jpg,Duplo,,2017,,3,,,,13,19 79 | 30324,My Town - Male,https://images.brickset.com/sets/small/30324-1.jpg,Duplo,,2017,,3,,,,5,15 80 | 30338,Fire Car,https://images.brickset.com/sets/small/30338-1.jpg,Juniors,Fire,2017,,,1,,,136,197 81 | 30351,Police Helicopter,https://images.brickset.com/sets/small/30351-1.jpg,City,Police,2017,4.0,44,1,,,1141,301 82 | 30352,Police Car,https://images.brickset.com/sets/small/30352-1.jpg,City,Police,2017,4.0,,1,,,940,255 83 | 30353,Tractor,https://images.brickset.com/sets/small/30353-1.jpg,City,Construction,2017,,,,,,113,718 84 | 30354,Hot Rod ,https://images.brickset.com/sets/small/30354-1.jpg,City,,2017,3.0,38,1,,,799,616 85 | 30355,Jungle ATV,https://images.brickset.com/sets/small/30355-1.jpg,City,Jungle,2017,,,,,,, 86 | 30376,Knighton Rider,https://images.brickset.com/sets/small/30376-1.jpg,Nexo Knights,Miscellaneous,2017,,,1,,,409,303 87 | 30377,Motor Horse,https://images.brickset.com/sets/small/30377-1.jpg,Nexo Knights,,2017,,,,,,49,365 88 | 30378,Shrunken Headquarters,https://images.brickset.com/sets/small/30378-1.jpg,Nexo Knights,Miscellaneous,2017,,,1,,,459,352 89 | 30400,Gymnastic Bar,https://images.brickset.com/sets/small/30400-1.jpg,Friends,,2017,,26,1,,,281,190 90 | 30401,Pool Foam Slide,https://images.brickset.com/sets/small/30401-1.jpg,Friends,Summer,2017,,,1,,,162,192 91 | 30402,{Ski practice},,Friends,Snow Resort,2017,,,,,,, 92 | 30425,CRU Master's Training Grounds,https://images.brickset.com/sets/small/30425-1.jpg,Ninjago,General,2017,,43,2,,,143,343 93 | 30426,Stealthy Swamp Airboat,https://images.brickset.com/sets/small/30426-1.jpg,Ninjago,The Hands of Time,2017,5.0,,1,,,130,277 94 | 30449,The Milano,https://images.brickset.com/sets/small/30449-1.jpg,Marvel Super Heroes,Guardians of the Galaxy Vol. 2,2017,,64,,,,119,774 95 | 30475,Off Roader,https://images.brickset.com/sets/small/30475-1.jpg,Creator,,2017,,,,,,18,251 96 | 30476,Happy Turtle,https://images.brickset.com/sets/small/30476-1.jpg,Creator,,2017,4.0,33,,,,133,415 97 | 30477,Chameleon,https://images.brickset.com/sets/small/30477-1.jpg,Creator,,2017,,53,,,,160,578 98 | 30478,Santa Claus,,Seasonal,Christmas,2017,,,,,,, 99 | 30496,U-Wing Fighter,https://images.brickset.com/sets/small/30496-1.jpg,Star Wars,Rogue One,2017,,55,,3.99,,572,795 100 | 30521,The Mini Batmobile,https://images.brickset.com/sets/small/30521-1.jpg,The LEGO Batman Movie,,2017,,68,,,,882,733 101 | 30522,Batman in the Phantom Zone,https://images.brickset.com/sets/small/30522-1.jpg,The LEGO Batman Movie,,2017,5.0,59,1,,,1906,822 102 | 30523,The Joker Battle Training,https://images.brickset.com/sets/small/30523-1.jpg,The LEGO Batman Movie,,2017,,49,1,,,1421,993 103 | 30524,The Mini Batwing,https://images.brickset.com/sets/small/30524-1.jpg,The LEGO Batman Movie,Promotional,2017,5.0,80,,,,2106,617 104 | 30546,Krypto Saves the Day,https://images.brickset.com/sets/small/30546-1.jpg,DC Super Hero Girls,Promotional,2017,,55,,,,708,244 105 | 30551,Cinderella's Kitchen,https://images.brickset.com/sets/small/30551-1.jpg,Disney,Cinderella,2017,,,1,,,41,348 106 | 30607,Disco Batman - Tears of Batman ,https://images.brickset.com/sets/small/30607-1.jpg,The LEGO Batman Movie,Promotional,2017,3.0,13,2,,,3564,925 107 | 30611,R2-D2,https://images.brickset.com/sets/small/30611-1.jpg,Star Wars,Promotional,2017,,70,,,,402,2489 108 | 30612,Batgirl,https://images.brickset.com/sets/small/30612-1.jpg,The LEGO Batman Movie,Promotional,2017,,9,,,,29,995 109 | 31054,Blue Express ,https://images.brickset.com/sets/small/31054-1.jpg,Creator,,2017,5.0,71,,4.99,4.99,878,504 110 | 31055,Red Racer,https://images.brickset.com/sets/small/31055-1.jpg,Creator,,2017,,72,,4.99,4.99,402,194 111 | 31056,Green Cruiser,https://images.brickset.com/sets/small/31056-1.jpg,Creator,,2017,,122,,9.99,9.99,347,273 112 | 31057,Air Blazer,https://images.brickset.com/sets/small/31057-1.jpg,Creator,,2017,,102,,9.99,9.99,291,223 113 | 31058,Mighty Dinosaurs,https://images.brickset.com/sets/small/31058-1.jpg,Creator,,2017,4.0,174,,14.99,14.99,1115,873 114 | 31059,Sunset Street Bike,https://images.brickset.com/sets/small/31059-1.jpg,Creator,,2017,,194,,19.99,19.99,185,231 115 | 31060,Airshow Aces,https://images.brickset.com/sets/small/31060-1.jpg,Creator,,2017,5.0,246,,19.99,19.99,192,225 116 | 31062,Robo Explorer,https://images.brickset.com/sets/small/31062-1.jpg,Creator,,2017,5.0,205,,19.99,17.99,945,891 117 | 31063,Beachside Vacation,https://images.brickset.com/sets/small/31063-1.jpg,Creator,,2017,,275,2,29.99,26.99,568,1073 118 | 31064,Island Adventures,https://images.brickset.com/sets/small/31064-1.jpg,Creator,,2017,4.5,359,1,29.99,29.99,410,825 119 | 31065,Park Street Townhouse,https://images.brickset.com/sets/small/31065-1.jpg,Creator,,2017,4.0,566,2,49.99,49.99,955,1900 120 | 31066,Space Shuttle Explorer,https://images.brickset.com/sets/small/31066-1.jpg,Creator,,2017,,285,,29.99,34.99,, 121 | 31067,Modular Poolside Holiday,https://images.brickset.com/sets/small/31067-1.jpg,Creator,,2017,,356,,29.99,24.99,, 122 | 31068,Modular Modern Home,https://images.brickset.com/sets/small/31068-1.jpg,Creator,,2017,,386,,29.99,39.99,, 123 | 31069,Modular Family Villa,https://images.brickset.com/sets/small/31069-1.jpg,Creator,,2017,,728,,69.99,64.99,, 124 | 31070,Turbo Track Racer,https://images.brickset.com/sets/small/31070-1.jpg,Creator,,2017,,664,,59.99,49.99,, 125 | 40171,Hedgehog Storage,https://images.brickset.com/sets/small/40171-1.jpg,Friends,Miscellaneous,2017,,249,,12.99,12.99,191,274 126 | 40172,Brick Calendar,https://images.brickset.com/sets/small/40172-1.jpg,Miscellaneous,Desk accessory,2017,5.0,278,1,19.99,19.99,709,558 127 | 40174,LEGO Chess,https://images.brickset.com/sets/small/40174-1.jpg,Miscellaneous,,2017,4.0,1450,,54.99,54.99,308,631 128 | 40175,{Policeman with cookie and stinger},https://images.brickset.com/sets/small/40175-1.jpg,City,Police,2017,,,1,,,88,471 129 | 40234,Year of the Rooster,https://images.brickset.com/sets/small/40234-1.jpg,Creator,Chinese New Year,2017,,,,,,530,315 130 | 40236,Romantic Valentine Picnic,https://images.brickset.com/sets/small/40236-1.jpg,Seasonal,Valentine's Day,2017,,126,2,9.99,9.99,2151,627 131 | 40237,Easter Egg Hunt,https://images.brickset.com/sets/small/40237-1.jpg,Seasonal,Easter,2017,,145,2,9.99,9.99,1790,623 132 | 40238,Halloween,https://images.brickset.com/sets/small/40238-1.jpg,Seasonal,Halloween,2017,,,,,,, 133 | 40239,Narwhal,https://images.brickset.com/sets/small/40239-1.jpg,Promotional,Monthly Mini Model Build,2017,5.0,,,,,212,183 134 | 40240,Raccoon,https://images.brickset.com/sets/small/40240-1.jpg,Promotional,Monthly Mini Model Build,2017,,,,,,192,195 135 | 40241,Platypus,https://images.brickset.com/sets/small/40241-1.jpg,Promotional,Monthly Mini Model Build,2017,,,,,,166,211 136 | 40242,Chick,https://images.brickset.com/sets/small/40242-1.jpg,Promotional,Monthly Mini Model Build,2017,,,,,,126,147 137 | 40243,Car,https://images.brickset.com/sets/small/40243-1.jpg,Promotional,Monthly Mini Model Build,2017,,,,,,24,126 138 | 40244,Dragonfly,,Promotional,Monthly Mini Model Build,2017,,,,,,, 139 | 40251,Mini Piggy Bank,,Creator,,2017,,,,,,, 140 | 40252,Mini Volkswagen Beetle,https://images.brickset.com/sets/small/40252-1.jpg,Creator,,2017,5.0,141,,,,2461,968 141 | 40256,Create The World,https://images.brickset.com/sets/small/40256-1.jpg,Creator,,2017,,,,,,18,217 142 | 40265,Tic-Tac-Toe,https://images.brickset.com/sets/small/40265-1.jpg,Friends,,2017,,,,,,, 143 | 40266,Storage Box,https://images.brickset.com/sets/small/40266-1.jpg,Friends,Accessories,2017,,105,,,,, 144 | 40267,Find A Pair Pack,https://images.brickset.com/sets/small/40267-1.jpg,Duplo,,2017,,,,,,2,27 145 | 40268,R3-M2,https://images.brickset.com/sets/small/40268-1.jpg,Star Wars,Rogue One,2017,,21,1,,,253,1629 146 | 41143,Berry's Kitchen,https://images.brickset.com/sets/small/41143-1.jpg,Disney,Palace Pets,2017,,61,,5.99,6.99,164,161 147 | 41144,Petite's Royal Stable,https://images.brickset.com/sets/small/41144-1.jpg,Disney,Palace Pets,2017,,75,,9.99,9.99,131,157 148 | 41145,Ariel and the Magical Spell,https://images.brickset.com/sets/small/41145-1.jpg,Disney,The Little Mermaid,2017,,222,,29.99,34.99,, 149 | 41146,Cinderella's Enchanted Evening,https://images.brickset.com/sets/small/41146-1.jpg,Disney,Cinderella,2017,,350,,39.99,,, 150 | 41147,Anna's Snow Adventure,https://images.brickset.com/sets/small/41147-1.jpg,Disney,Frozen,2017,,153,1,19.99,19.99,237,374 151 | 41148,Elsa's Magical Ice Palace,https://images.brickset.com/sets/small/41148-1.jpg,Disney,Frozen,2017,,701,,79.99,69.99,266,703 152 | 41149,Moana's Island Adventure,https://images.brickset.com/sets/small/41149-1.jpg,Disney,Moana,2017,,205,1,24.99,29.99,418,361 153 | 41150,Moana's Ocean Voyage,https://images.brickset.com/sets/small/41150-1.jpg,Disney,Moana,2017,4.0,307,2,39.99,39.99,695,485 154 | 41181,Naida's Gondola & the Goblin Thief,https://images.brickset.com/sets/small/41181-1.jpg,Elves,,2017,,67,2,9.99,9.99,267,392 155 | 41182,The Capture of Sophie Jones,https://images.brickset.com/sets/small/41182-1.jpg,Elves,,2017,,226,2,19.99,19.99,264,424 156 | 41183,The Goblin King's Evil Dragon,https://images.brickset.com/sets/small/41183-1.jpg,Elves,,2017,4.0,339,2,29.99,29.99,283,535 157 | 41184,Aira's Airship & the Amulet Chase,https://images.brickset.com/sets/small/41184-1.jpg,Elves,,2017,,343,3,39.99,39.99,227,589 158 | 41185,Magic Rescue from the Goblin Village,https://images.brickset.com/sets/small/41185-1.jpg,Elves,,2017,,637,5,59.99,59.99,177,576 159 | 41186,Azari & the Goblin Forest Escape,https://images.brickset.com/sets/small/41186-1.jpg,Elves,,2017,,145,,19.99,19.99,, 160 | 41187,Rosalyn's Healing Hideout,https://images.brickset.com/sets/small/41187-1.jpg,Elves,,2017,,460,,49.99,49.99,, 161 | 41188,Breakout from the Goblin King's Fortress,https://images.brickset.com/sets/small/41188-1.jpg,Elves,,2017,,695,,69.99,79.99,, 162 | 41189,{?},,Elves,,2017,,,,,,, 163 | 41230,Batgirl Batjet Chase,https://images.brickset.com/sets/small/41230-1.jpg,DC Super Hero Girls,,2017,,206,1,24.99,24.99,514,359 164 | 41231,Harley Quinn to the Rescue,https://images.brickset.com/sets/small/41231-1.jpg,DC Super Hero Girls,,2017,,217,2,29.99,29.99,358,357 165 | 41232,Super Hero High School,https://images.brickset.com/sets/small/41232-1.jpg,DC Super Hero Girls,,2017,,712,3,79.99,79.99,305,366 166 | 41233,Lashina Tank,https://images.brickset.com/sets/small/41233-1.jpg,DC Super Hero Girls,,2017,,145,1,14.99,14.99,326,298 167 | 41234,Bumblebee Helicopter,https://images.brickset.com/sets/small/41234-1.jpg,DC Super Hero Girls,,2017,,142,1,14.99,14.99,356,297 168 | 41235,Wonder Woman Dorm Room,https://images.brickset.com/sets/small/41235-1.jpg,DC Super Hero Girls,,2017,,186,1,19.99,19.99,504,420 169 | 41236,Harley Quinn Dorm,https://images.brickset.com/sets/small/41236-1.jpg,DC Super Hero Girls,,2017,,176,,19.99,,, 170 | 41237,Batgirl Secret Bunker,https://images.brickset.com/sets/small/41237-1.jpg,DC Super Hero Girls,,2017,,351,,44.99,,, 171 | 41238,Lena Luthor Kryptomite Factory,https://images.brickset.com/sets/small/41238-1.jpg,DC Super Hero Girls,,2017,,432,,59.99,,, 172 | 41239,Eclipso Dark Palace,https://images.brickset.com/sets/small/41239-1.jpg,DC Super Hero Girls,,2017,,1078,,99.99,,, 173 | 41300,Puppy Championship,https://images.brickset.com/sets/small/41300-1.jpg,Friends,Dog Show,2017,,185,1,19.99,19.99,149,213 174 | 41301,Puppy Parade,https://images.brickset.com/sets/small/41301-1.jpg,Friends,Dog Show,2017,,145,1,14.99,14.99,200,217 175 | 41302,Puppy Pampering,https://images.brickset.com/sets/small/41302-1.jpg,Friends,Dog Show,2017,,45,,4.99,4.99,258,179 176 | 41303,Puppy Playground,https://images.brickset.com/sets/small/41303-1.jpg,Friends,Dog Show,2017,,62,,4.99,4.99,230,182 177 | 41304,Puppy Treats & Tricks,https://images.brickset.com/sets/small/41304-1.jpg,Friends,Dog Show,2017,,45,,4.99,4.99,221,185 178 | 41305,Emma's Photo Studio,https://images.brickset.com/sets/small/41305-1.jpg,Friends,,2017,,96,1,9.99,9.99,314,307 179 | 41306,Mia's Beach Scooter,https://images.brickset.com/sets/small/41306-1.jpg,Friends,Summer,2017,4.0,79,1,9.99,9.99,336,291 180 | 41307,Olivia's Creative Lab,https://images.brickset.com/sets/small/41307-1.jpg,Friends,,2017,,91,,9.99,9.99,389,344 181 | 41308,Stephanie's Friendship Cakes,https://images.brickset.com/sets/small/41308-1.jpg,Friends,,2017,,94,1,9.99,9.99,288,263 182 | 41309,Andrea's Musical Duet,https://images.brickset.com/sets/small/41309-1.jpg,Friends,,2017,3.0,86,1,9.99,9.99,173,234 183 | 41310,Heartlake Gift Delivery,https://images.brickset.com/sets/small/41310-1.jpg,Friends,Party,2017,,185,1,19.99,19.99,259,313 184 | 41311,Heartlake Pizzeria,https://images.brickset.com/sets/small/41311-1.jpg,Friends,,2017,4.0,289,2,29.99,29.99,520,581 185 | 41312,Heartlake Sports Centre,https://images.brickset.com/sets/small/41312-1.jpg,Friends,,2017,,328,2,39.99,39.99,165,343 186 | 41313,Heartlake Summer Pool,https://images.brickset.com/sets/small/41313-1.jpg,Friends,Summer,2017,,589,2,49.99,49.99,231,417 187 | 41314,Stephanie's House,https://images.brickset.com/sets/small/41314-1.jpg,Friends,,2017,,622,3,69.99,69.99,272,512 188 | 41315,Heartlake Surf Shop,https://images.brickset.com/sets/small/41315-1.jpg,Friends,Summer,2017,,186,,,19.99,, 189 | 41316,Andrea's Speedboat Transporter,https://images.brickset.com/sets/small/41316-1.jpg,Friends,Summer,2017,,309,,,29.99,, 190 | 41317,Sunshine Catamaran,https://images.brickset.com/sets/small/41317-1.jpg,Friends,Summer,2017,,603,,,74.99,, 191 | 41318,Heartlake Hospital,https://images.brickset.com/sets/small/41318-1.jpg,Friends,,2017,,871,,,99.99,, 192 | 41319,{Hot cocoa van},,Friends,Snow Resort,2017,,,,,,, 193 | 41320,Heartlake Frozen Yogurt Shop,,Friends,,2017,,,,,,, 194 | 41321,Snow Resort Off-Roader,https://images.brickset.com/sets/small/41321-1.jpg,Friends,Snow Resort,2017,,,,14.99,17.99,, 195 | 41322,Snow Resort Ice Rink,https://images.brickset.com/sets/small/41322-1.jpg,Friends,Snow Resort,2017,,307,,,29.99,, 196 | 41323,Snow Resort Chalet,https://images.brickset.com/sets/small/41323-1.jpg,Friends,Snow Resort,2017,,402,,,44.99,, 197 | 41324,Snow Resort Ski Lift,https://images.brickset.com/sets/small/41324-1.jpg,Friends,Snow Resort,2017,,585,,,59.99,, 198 | 41326,Friends Advent Calendar,https://images.brickset.com/sets/small/41326-1.jpg,Friends,Seasonal,2017,,217,,29.99,,, 199 | 41328,{?},,Friends,,2017,,,,,,, 200 | 41329,{?},,Friends,,2017,,,,,,, 201 | 41330,{?},,Friends,,2017,,,,,,, 202 | 41585,Batman,https://images.brickset.com/sets/small/41585-1.jpg,BrickHeadz,DC Comics Super Heroes,2017,,91,,9.99,9.99,989,514 203 | 41586,Batgirl,https://images.brickset.com/sets/small/41586-1.jpg,BrickHeadz,DC Comics Super Heroes,2017,,99,,9.99,9.99,716,475 204 | 41587,Robin,https://images.brickset.com/sets/small/41587-1.jpg,BrickHeadz,DC Comics Super Heroes,2017,,101,,9.99,9.99,798,467 205 | 41588,The Joker,https://images.brickset.com/sets/small/41588-1.jpg,BrickHeadz,DC Comics Super Heroes,2017,,151,,9.99,9.99,928,507 206 | 41589,Captain America,https://images.brickset.com/sets/small/41589-1.jpg,BrickHeadz,Marvel Super Heroes,2017,,79,,9.99,9.99,791,505 207 | 41590,Iron Man,https://images.brickset.com/sets/small/41590-1.jpg,BrickHeadz,Marvel Super Heroes,2017,,96,,9.99,9.99,823,567 208 | 41591,Black Widow,https://images.brickset.com/sets/small/41591-1.jpg,BrickHeadz,Marvel Super Heroes,2017,,143,,9.99,9.99,641,498 209 | 41592,The Hulk,https://images.brickset.com/sets/small/41592-1.jpg,BrickHeadz,Marvel Super Heroes,2017,,93,,9.99,9.99,618,464 210 | 41593,Captain Jack Sparrow,https://images.brickset.com/sets/small/41593-1.jpg,BrickHeadz,Disney,2017,,109,,9.99,9.99,548,504 211 | 41594,Captain Armando Salazar,https://images.brickset.com/sets/small/41594-1.jpg,BrickHeadz,Disney,2017,,118,,9.99,9.99,477,437 212 | 41595,Belle,https://images.brickset.com/sets/small/41595-1.jpg,BrickHeadz,Disney,2017,,139,,9.99,9.99,750,402 213 | 41596,Beast,https://images.brickset.com/sets/small/41596-1.jpg,BrickHeadz,Disney,2017,,116,,9.99,9.99,707,403 214 | 42057,Ultralight Helicopter,https://images.brickset.com/sets/small/42057-1.jpg,Technic,,2017,5.0,199,,19.99,14.99,563,462 215 | 42058,Stunt Bike,https://images.brickset.com/sets/small/42058-1.jpg,Technic,,2017,5.0,140,,19.99,19.99,312,341 216 | 42059,Stunt Truck,https://images.brickset.com/sets/small/42059-1.jpg,Technic,,2017,5.0,142,,19.99,19.99,324,344 217 | 42060,Roadwork Crew,https://images.brickset.com/sets/small/42060-1.jpg,Technic,,2017,4.0,365,,29.99,19.99,333,396 218 | 42061,Telehandler,https://images.brickset.com/sets/small/42061-1.jpg,Technic,,2017,4.3,260,,39.99,29.99,393,482 219 | 42062,Container Yard,https://images.brickset.com/sets/small/42062-1.jpg,Technic,,2017,,631,,,49.99,284,660 220 | 42063,BMW R 1200 GS Adventure,https://images.brickset.com/sets/small/42063-1.jpg,Technic,,2017,,603,,59.99,49.99,1047,1141 221 | 42064,Ocean Explorer,https://images.brickset.com/sets/small/42064-1.jpg,Technic,,2017,,1327,,,89.99,472,1420 222 | 42065,RC Tracked Racer,https://images.brickset.com/sets/small/42065-1.jpg,Technic,,2017,4.5,370,,,79.99,684,1289 223 | 42066,Air Race Jet,https://images.brickset.com/sets/small/42066-1.jpg,Technic,,2017,,1151,,159.99,119.99,305,826 224 | 42068,Airport Rescue Vehicle,https://images.brickset.com/sets/small/42068-1.jpg,Technic,,2017,,,,99.99,,, 225 | 42069,Extreme Adventure,https://images.brickset.com/sets/small/42069-1.jpg,Technic,,2017,,,,179.99,,, 226 | 42070,6x6 All Terrain Tow Truck,https://images.brickset.com/sets/small/42070-1.jpg,Technic,,2017,,1862,,289.99,,, 227 | 45021,Our Town,https://images.brickset.com/sets/small/45021-1.jpg,Education,Duplo,2017,,,,,,1,5 228 | 60135,ATV Arrest,https://images.brickset.com/sets/small/60135-1.jpg,City,Police,2017,,47,,6.99,5.99,642,436 229 | 60136,Police Starter Set,https://images.brickset.com/sets/small/60136-1.jpg,City,Police,2017,5.0,80,4,9.99,9.99,803,566 230 | 60137,Tow Truck Trouble,https://images.brickset.com/sets/small/60137-1.jpg,City,Police,2017,5.0,144,3,19.99,19.99,562,680 231 | 60138,High-speed Chase,https://images.brickset.com/sets/small/60138-1.jpg,City,Police,2017,3.0,294,,39.99,29.99,440,578 232 | 60139,Mobile Command Center,https://images.brickset.com/sets/small/60139-1.jpg,City,Police,2017,,374,,49.99,39.99,242,500 233 | 60140,Bulldozer Break-In,https://images.brickset.com/sets/small/60140-1.jpg,City,Police,2017,,561,5,69.99,59.99,355,1039 234 | 60141,Police Station,https://images.brickset.com/sets/small/60141-1.jpg,City,Police,2017,,894,,99.99,99.99,215,681 235 | 60142,Money Transporter,https://images.brickset.com/sets/small/60142-1.jpg,City,Police,2017,3.0,138,,19.99,14.99,371,589 236 | 60143,Auto Transport Heist,https://images.brickset.com/sets/small/60143-1.jpg,City,Police,2017,4.0,403,,,,202,852 237 | 60144,Race Plane,https://images.brickset.com/sets/small/60144-1.jpg,City,General,2017,4.3,89,1,9.99,9.99,842,658 238 | 60145,Buggy,https://images.brickset.com/sets/small/60145-1.jpg,City,Traffic,2017,4.0,81,1,9.99,9.99,1120,863 239 | 60146,Stunt Truck,https://images.brickset.com/sets/small/60146-1.jpg,City,Traffic,2017,,91,1,9.99,9.99,1049,749 240 | 60147,Fishing Boat,https://images.brickset.com/sets/small/60147-1.jpg,City,Harbour,2017,4.5,144,2,19.99,19.99,991,1109 241 | 60148,ATV Race Team,https://images.brickset.com/sets/small/60148-1.jpg,City,Traffic,2017,4.0,239,2,19.99,19.99,788,741 242 | 60149,4x4 with Catamaran,https://images.brickset.com/sets/small/60149-1.jpg,City,Harbour,2017,5.0,198,2,19.99,19.99,952,1012 243 | 60150,Pizza Van,https://images.brickset.com/sets/small/60150-1.jpg,City,Traffic,2017,4.5,249,2,19.99,19.99,3127,1923 244 | 60151,Dragster Transporter,https://images.brickset.com/sets/small/60151-1.jpg,City,Traffic,2017,4.0,333,2,29.99,29.99,508,644 245 | 60152,Sweeper & Excavator,https://images.brickset.com/sets/small/60152-1.jpg,City,Construction,2017,,299,2,29.99,29.99,783,921 246 | 60153,People Pack - Fun at the Beach,https://images.brickset.com/sets/small/60153-1.jpg,City,General,2017,,169,,39.99,44.99,, 247 | 60154,Bus Station,https://images.brickset.com/sets/small/60154-1.jpg,City,Traffic,2017,,,,49.99,44.99,, 248 | 60155,City Advent Calendar,https://images.brickset.com/sets/small/60155-1.jpg,City,Seasonal,2017,,248,,29.99,,, 249 | 60156,Jungle Buggy,https://images.brickset.com/sets/small/60156-1.jpg,City,Jungle,2017,,53,,6.99,5.99,, 250 | 60157,Jungle Starter Set,https://images.brickset.com/sets/small/60157-1.jpg,City,Jungle,2017,,,,9.99,9.99,, 251 | 60158,Jungle Cargo Helicopter ,https://images.brickset.com/sets/small/60158-1.jpg,City,Jungle,2017,,,,,19.99,, 252 | 60159,Jungle Halftrack Mission,https://images.brickset.com/sets/small/60159-1.jpg,City,Jungle,2017,,378,,39.99,29.99,, 253 | 60160,Jungle Mobile Lab,https://images.brickset.com/sets/small/60160-1.jpg,City,Jungle,2017,,426,,59.99,49.99,, 254 | 60161,Jungle Exploration Site,https://images.brickset.com/sets/small/60161-1.jpg,City,Jungle,2017,,813,,119.99,99.99,, 255 | 60162,Jungle Air Drop Helicopter,,City,Jungle,2017,,,,,,, 256 | 60163,Coast Guard Starter Set,https://images.brickset.com/sets/small/60163-1.jpg,City,Coast Guard,2017,,76,,9.99,9.99,, 257 | 60164,Sea Rescue Plane,https://images.brickset.com/sets/small/60164-1.jpg,City,Coast Guard,2017,,141,,19.99,19.99,, 258 | 60165,4 x 4 Response Unit ,https://images.brickset.com/sets/small/60165-1.jpg,City,Coast Guard,2017,,347,,39.99,29.99,, 259 | 60166,Heavy-Duty Rescue Helicopter,https://images.brickset.com/sets/small/60166-1.jpg,City,Coast Guard,2017,,415,,59.99,49.99,, 260 | 60167,Coast Guard Head Quarters,https://images.brickset.com/sets/small/60167-1.jpg,City,Coast Guard,2017,,,,119.99,99.99,, 261 | 60168,Sailboat Rescue,,City,Coast Guard,2017,,,,,,, 262 | 60169,Cargo Terminal,https://images.brickset.com/sets/small/60169-1.jpg,City,,2017,,,,79.99,74.99,, 263 | 66546,The LEGO Batman Movie Super Pack 2-in-1,https://images.brickset.com/sets/small/66546-1.jpg,The LEGO Batman Movie,Product Collection,2017,,378,,44.98,,103,197 264 | 70347,King's Guard Artillery,https://images.brickset.com/sets/small/70347-1.jpg,Nexo Knights,Season 3,2017,,98,2,9.99,9.99,408,337 265 | 70348,Lance's Twin Jouster,https://images.brickset.com/sets/small/70348-1.jpg,Nexo Knights,Season 3,2017,5.0,216,,19.99,19.99,440,398 266 | 70349,Ruina's Lock & Roller,https://images.brickset.com/sets/small/70349-1.jpg,Nexo Knights,Season 3,2017,4.3,208,3,19.99,19.99,517,408 267 | 70350,The Three Brothers,https://images.brickset.com/sets/small/70350-1.jpg,Nexo Knights,Season 3,2017,,266,3,29.99,32.99,286,375 268 | 70351,Clay's Falcon Fighter Blaster,https://images.brickset.com/sets/small/70351-1.jpg,Nexo Knights,Season 3,2017,,523,,49.99,49.99,285,482 269 | 70352,Jestro's Headquarters,https://images.brickset.com/sets/small/70352-1.jpg,Nexo Knights,Season 3,2017,,840,,89.99,99.99,185,419 270 | 70353,The Heligoyle,https://images.brickset.com/sets/small/70353-1.jpg,Nexo Knights,Season 4,2017,,318,,29.99,34.99,, 271 | 70354,Axl's Rumble Maker,https://images.brickset.com/sets/small/70354-1.jpg,Nexo Knights,Season 4,2017,,318,,39.99,44.99,, 272 | 70355,Aaron's Rock Climber,https://images.brickset.com/sets/small/70355-1.jpg,Nexo Knights,Season 4,2017,,598,,59.99,64.99,, 273 | 70356,The Stone Colossus of Ultimate Destruction,https://images.brickset.com/sets/small/70356-1.jpg,Nexo Knights,Season 4,2017,,785,,69.99,74.99,, 274 | 70357,Knighton Castle,https://images.brickset.com/sets/small/70357-1.jpg,Nexo Knights,Season 4,2017,,1426,,129.99,139.99,, 275 | 70358,Aaron's Stone Destroyer,https://images.brickset.com/sets/small/70358-1.jpg,Nexo Knights,Season 3,2017,,251,,24.99,24.99,132,360 276 | 70359,Lance vs. Lightning,https://images.brickset.com/sets/small/70359-1.jpg,Nexo Knights,Season 3,2017,,257,,24.99,24.99,194,466 277 | 70361,Macy's Bot Drop Dragon,https://images.brickset.com/sets/small/70361-1.jpg,Nexo Knights,Season 4,2017,,153,,14.99,17.99,, 278 | 70362,Battle Suit Clay,https://images.brickset.com/sets/small/70362-1.jpg,Nexo Knights,Battle Suits,2017,,79,1,9.99,9.99,641,376 279 | 70363,Battle Suit Macy,https://images.brickset.com/sets/small/70363-1.jpg,Nexo Knights,Battle Suits,2017,,66,,9.99,9.99,455,361 280 | 70364,Battle Suit Aaron,https://images.brickset.com/sets/small/70364-1.jpg,Nexo Knights,Battle Suits,2017,5.0,80,1,9.99,9.99,523,372 281 | 70365,Battle Suit Axl,https://images.brickset.com/sets/small/70365-1.jpg,Nexo Knights,Battle Suits,2017,,88,1,9.99,9.99,639,395 282 | 70366,Battle Suit Lance,https://images.brickset.com/sets/small/70366-1.jpg,Nexo Knights,Battle Suits,2017,,83,1,9.99,9.99,518,347 283 | 70372,Combo NEXO Powers Wave 1,https://images.brickset.com/sets/small/70372-1.jpg,Nexo Knights,Combo NEXO Powers,2017,4.0,10,,3.99,3.99,455,184 284 | 70373,Combo NEXO Powers Wave 2,https://images.brickset.com/sets/small/70373-1.jpg,Nexo Knights,Combo NEXO Powers,2017,,10,,3.99,3.99,, 285 | 70606,Spinjitzu Training,,The LEGO Ninjago Movie,,2017,,,,,9.99,, 286 | 70607,Ninjago City Chase,,The LEGO Ninjago Movie,,2017,,,,,19.99,, 287 | 70608,Master Falls,,The LEGO Ninjago Movie,,2017,,,,,34.99,, 288 | 70609,Manta Ray Bomber,,The LEGO Ninjago Movie,,2017,,,,,34.99,, 289 | 70610,{?},,The LEGO Ninjago Movie,,2017,,,,,,, 290 | 70611,Water Strider,,The LEGO Ninjago Movie,,2017,,,,,44.99,, 291 | 70612,Green Ninja Mech Dragon,,The LEGO Ninjago Movie,,2017,,544,,,54.99,, 292 | 70613,Garmadon's Shark Mech,,The LEGO Ninjago Movie,,2017,,,,,,, 293 | 70614,Lightning Jet,,The LEGO Ninjago Movie,,2017,,,,,69.99,, 294 | 70615,Fire Mech,,The LEGO Ninjago Movie,,2017,,,,,79.99,, 295 | 70616,{?},,The LEGO Ninjago Movie,,2017,,,,,,, 296 | 70617,Temple of the Ultimate Ultimate Weapon,,The LEGO Ninjago Movie,,2017,,,,,99.99,, 297 | 70618,Destiny's Bounty,,The LEGO Ninjago Movie,,2017,,,,,169.99,, 298 | 70620,{?},,The LEGO Ninjago Movie,,2017,,,,299.99,,, 299 | 70621,The Vermillion Attack,https://images.brickset.com/sets/small/70621-1.jpg,Ninjago,The Hands of Time,2017,,83,3,9.99,9.99,661,473 300 | 70622,Desert Lightning,https://images.brickset.com/sets/small/70622-1.jpg,Ninjago,The Hands of Time,2017,4.0,201,3,19.99,19.99,260,319 301 | 70623,Destiny's Shadow,https://images.brickset.com/sets/small/70623-1.jpg,Ninjago,The Hands of Time,2017,5.0,360,3,29.99,29.99,242,368 302 | 70624,Vermillion Invader,https://images.brickset.com/sets/small/70624-1.jpg,Ninjago,The Hands of Time,2017,4.0,313,3,29.99,29.99,181,315 303 | 70625,Samurai VXL,https://images.brickset.com/sets/small/70625-1.jpg,Ninjago,The Hands of Time,2017,,428,4,49.99,39.99,175,450 304 | 70626,Dawn of Iron Doom,https://images.brickset.com/sets/small/70626-1.jpg,Ninjago,The Hands of Time,2017,5.0,704,6,59.99,59.99,223,486 305 | 70627,Dragon's Forge,https://images.brickset.com/sets/small/70627-1.jpg,Ninjago,The Hands of Time,2017,,1137,6,79.99,79.99,332,606 306 | 70900,The Joker Balloon Escape,https://images.brickset.com/sets/small/70900-1.jpg,The LEGO Batman Movie,,2017,4.0,124,2,14.99,14.99,3129,1415 307 | 70901,Mr. Freeze Ice Attack,https://images.brickset.com/sets/small/70901-1.jpg,The LEGO Batman Movie,,2017,4.7,201,3,19.99,24.99,2403,1189 308 | 70902,Catwoman Catcycle Chase,https://images.brickset.com/sets/small/70902-1.jpg,The LEGO Batman Movie,,2017,4.5,139,3,19.99,24.99,2675,1342 309 | 70903,The Riddler Riddle Racer,https://images.brickset.com/sets/small/70903-1.jpg,The LEGO Batman Movie,,2017,5.0,254,5,29.99,34.99,2143,1363 310 | 70904,Clayface Splat Attack,https://images.brickset.com/sets/small/70904-1.jpg,The LEGO Batman Movie,,2017,4.5,448,2,34.99,34.99,1651,1424 311 | 70905,The Batmobile,https://images.brickset.com/sets/small/70905-1.jpg,The LEGO Batman Movie,,2017,5.0,581,5,59.99,59.99,1848,1414 312 | 70906,The Joker Notorious Lowrider,https://images.brickset.com/sets/small/70906-1.jpg,The LEGO Batman Movie,,2017,5.0,433,3,49.99,49.99,2597,1872 313 | 70907,Killer Croc Tail-Gator,https://images.brickset.com/sets/small/70907-1.jpg,The LEGO Batman Movie,,2017,,460,4,69.99,69.99,973,1523 314 | 70908, The Scuttler,https://images.brickset.com/sets/small/70908-1.jpg,The LEGO Batman Movie,,2017,4.0,775,6,79.99,79.99,1215,1674 315 | 70909,Batcave Break-In,https://images.brickset.com/sets/small/70909-1.jpg,The LEGO Batman Movie,,2017,4.0,1047,7,99.99,99.99,1744,1548 316 | 70910,Scarecrow Special Delivery,https://images.brickset.com/sets/small/70910-1.jpg,The LEGO Batman Movie,,2017,3.5,204,3,19.99,24.99,1550,1339 317 | 70911,The Penguin Arctic Roller,https://images.brickset.com/sets/small/70911-1.jpg,The LEGO Batman Movie,,2017,5.0,305,2,29.99,34.99,2431,1845 318 | 70912,Arkham Asylum,https://images.brickset.com/sets/small/70912-1.jpg,The LEGO Batman Movie,,2017,4.0,1628,13,149.99,149.99,888,2192 319 | 70913,Scarecrow Fearful Face-off,https://images.brickset.com/sets/small/70913-1.jpg,The LEGO Batman Movie,,2017,,141,,14.99,17.99,, 320 | 70914,Bane Toxic Truck Attack,https://images.brickset.com/sets/small/70914-1.jpg,The LEGO Batman Movie,,2017,,366,,49.99,54.99,, 321 | 70915,Two-Face Double Demolition,https://images.brickset.com/sets/small/70915-1.jpg,The LEGO Batman Movie,,2017,,564,,59.99,54.99,, 322 | 70916,The Batwing,https://images.brickset.com/sets/small/70916-1.jpg,The LEGO Batman Movie,,2017,,1053,,89.99,99.99,, 323 | 70917,The Ultimate Batmobile,https://images.brickset.com/sets/small/70917-1.jpg,The LEGO Batman Movie,,2017,,1456,,129.99,139.99,, 324 | 71017,LEGO Minifigures - The LEGO Batman Movie Series {Random bag},https://images.brickset.com/sets/small/71017-0.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,,,,,,387,243 325 | 71017,Lobster-Lovin' Batman,https://images.brickset.com/sets/small/71017-12.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,5.0,6,1,,,3299,620 326 | 71017,Glam Metal Batman,https://images.brickset.com/sets/small/71017-8.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,5.0,7,1,,,3127,597 327 | 71017,Fairy Batman,https://images.brickset.com/sets/small/71017-5.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,5.0,7,1,,,3007,474 328 | 71017,Clan of the Cave Batman,https://images.brickset.com/sets/small/71017-4.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,,6,1,,,2844,405 329 | 71017,Vacation Batman,https://images.brickset.com/sets/small/71017-13.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,4.5,7,1,,,3287,580 330 | 71017,Barbara Gordon,https://images.brickset.com/sets/small/71017-14.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,,7,1,,,2788,468 331 | 71017,Commissioner Gordon,https://images.brickset.com/sets/small/71017-6.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,4.0,6,1,,,2895,558 332 | 71017,Arkham Asylum Joker,https://images.brickset.com/sets/small/71017-1.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,,5,1,,,2781,440 333 | 71017,Dick Grayson,https://images.brickset.com/sets/small/71017-17.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,5.0,6,1,,,2897,476 334 | 71017,Pink Power Batgirl,https://images.brickset.com/sets/small/71017-10.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,,7,1,,,2907,396 335 | 71017,Red Hood,https://images.brickset.com/sets/small/71017-18.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,5.0,8,1,,,3014,468 336 | 71017,Eraser,https://images.brickset.com/sets/small/71017-16.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,5.0,5,1,,,2894,488 337 | 71017,Nurse Harley Quinn,https://images.brickset.com/sets/small/71017-3.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,5.0,6,1,,,3084,529 338 | 71017,Orca,https://images.brickset.com/sets/small/71017-9.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,4.0,4,1,,,3001,500 339 | 71017,Zodiac Master,https://images.brickset.com/sets/small/71017-20.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,5.0,5,1,,,2597,356 340 | 71017,Catman,https://images.brickset.com/sets/small/71017-2.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,5.0,8,1,,,2846,465 341 | 71017,March Harriet,https://images.brickset.com/sets/small/71017-19.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,4.0,5,1,,,2870,477 342 | 71017,Calculator,https://images.brickset.com/sets/small/71017-15.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,5.0,7,1,,,2818,404 343 | 71017,King Tut,https://images.brickset.com/sets/small/71017-7.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,4.0,7,1,,,2833,463 344 | 71017,Mime,https://images.brickset.com/sets/small/71017-11.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,5.0,6,1,,,2576,373 345 | 71017,LEGO Minifigures - The LEGO Batman Movie Series - Complete,https://images.brickset.com/sets/small/71017-21.jpg,Collectable Minifigures,The LEGO Batman Movie,2017,,125,20,,,1546,363 346 | 71017,LEGO Minifigures - The LEGO Batman Movie - Sealed Box,,Collectable Minifigures,The LEGO Batman Movie,2017,,,,3.99,3.99,149,108 347 | 71018,LEGO Minifigures - Series 17 {Random bag},https://images.brickset.com/sets/small/71018-0.jpg,Collectable Minifigures,Series 17,2017,,,,,,, 348 | 71018,Professional Surfer,https://images.brickset.com/sets/small/71018-1.jpg,Collectable Minifigures,Series 17,2017,,,,,,263,445 349 | 71018,Circus Strong Man,https://images.brickset.com/sets/small/71018-2.jpg,Collectable Minifigures,Series 17,2017,,,,,,268,347 350 | 71018,Gourmet Chef,https://images.brickset.com/sets/small/71018-3.jpg,Collectable Minifigures,Series 17,2017,,,,,,263,541 351 | 71018,Corn Cob Guy,https://images.brickset.com/sets/small/71018-4.jpg,Collectable Minifigures,Series 17,2017,,,,,,358,528 352 | 71018,Veterinarian,https://images.brickset.com/sets/small/71018-5.jpg,Collectable Minifigures,Series 17,2017,,,,,,269,557 353 | 71018,Hot Dog Man,https://images.brickset.com/sets/small/71018-6.jpg,Collectable Minifigures,Series 17,2017,,,,,,319,617 354 | 71018,Butterfly Girl,https://images.brickset.com/sets/small/71018-7.jpg,Collectable Minifigures,Series 17,2017,,,,,,253,441 355 | 71018,Roman Gladiator,https://images.brickset.com/sets/small/71018-8.jpg,Collectable Minifigures,Series 17,2017,,,,,,253,404 356 | 71018,Connoisseur,https://images.brickset.com/sets/small/71018-9.jpg,Collectable Minifigures,Series 17,2017,,,,,,324,552 357 | 71018,Battle Dwarf,https://images.brickset.com/sets/small/71018-10.jpg,Collectable Minifigures,Series 17,2017,,,,,,252,433 358 | 71018,Retro Spaceman,https://images.brickset.com/sets/small/71018-11.jpg,Collectable Minifigures,Series 17,2017,,,,,,292,481 359 | 71018,Yuppie,https://images.brickset.com/sets/small/71018-12.jpg,Collectable Minifigures,Series 17,2017,,,,,,282,422 360 | 71018,Rocket Boy,https://images.brickset.com/sets/small/71018-13.jpg,Collectable Minifigures,Series 17,2017,,,,,,348,578 361 | 71018,Dance Instructor,https://images.brickset.com/sets/small/71018-14.jpg,Collectable Minifigures,Series 17,2017,,,,,,268,386 362 | 71018,Elf Girl,https://images.brickset.com/sets/small/71018-15.jpg,Collectable Minifigures,Series 17,2017,,,,,,274,451 363 | 71018,Highwayman,,Collectable Minifigures,Series 17,2017,4.5,,,3.99,3.99,306,403 364 | 71018,LEGO Minifigures - Series 17 - Complete,https://images.brickset.com/sets/small/71018-17.jpg,Collectable Minifigures,Series 17,2017,,,,,,, 365 | 71019,LEGO Minifigures - The LEGO Ninjago Movie {Random bag},,Collectable Minifigures,The LEGO Ninjago Movie,2017,,,,,,, 366 | 71042,Silent Mary,https://images.brickset.com/sets/small/71042-1.jpg,Pirates of the Caribbean,Dead Men Tell No Tales,2017,,2294,8,199.99,199.99,537,1467 367 | 71250,{Ghostbusters Reboot 2},,Dimensions,,2017,,,,,,, 368 | 71254,{Teen Titans Go! 1},,Dimensions,,2017,,,,,,, 369 | 71255,{Teen Titans Go! 2},,Dimensions,,2017,,,,,,, 370 | 71264,The LEGO Batman Movie: Play the Complete Movie,https://images.brickset.com/sets/small/71264-1.jpg,Dimensions,Story Pack,2017,,156,2,44.99,44.99,951,1040 371 | 71266,Chase McCain,https://images.brickset.com/sets/small/71266-1.jpg,Dimensions,Fun Pack,2017,,46,,11.99,,26,752 372 | 71267,The Goonies Level Pack,https://images.brickset.com/sets/small/71267-1.jpg,Dimensions,Level Pack,2017,,118,,29.99,,36,1182 373 | 71286,Michael Knight,https://images.brickset.com/sets/small/71286-1.jpg,Dimensions,Fun Pack,2017,,55,1,14.99,14.99,809,1264 374 | 71344,Excalibur Batman,https://images.brickset.com/sets/small/71344-1.jpg,Dimensions,Fun Pack,2017,,57,1,14.99,14.99,1052,1257 375 | 71348,Hermione Granger,https://images.brickset.com/sets/small/71348-1.jpg,Dimensions,Fun Pack,2017,,64,,11.99,,40,1014 376 | 75144,Snowspeeder,https://images.brickset.com/sets/small/75144-1.jpg,Star Wars,Ultimate Collector Series,2017,,1703,,199.99,199.99,188,3468 377 | 75160,U-wing,https://images.brickset.com/sets/small/75160-1.jpg,Star Wars,MicroFighters,2017,4.0,109,1,9.99,8.99,1976,1274 378 | 75161,TIE Striker,https://images.brickset.com/sets/small/75161-1.jpg,Star Wars,MicroFighters,2017,,88,1,9.99,8.99,1514,1122 379 | 75162,Y-wing,https://images.brickset.com/sets/small/75162-1.jpg,Star Wars,MicroFighters,2017,,90,1,9.99,8.99,1938,1335 380 | 75163,Krennic's Imperial Shuttle,https://images.brickset.com/sets/small/75163-1.jpg,Star Wars,MicroFighters,2017,4.0,78,1,9.99,8.99,1680,1197 381 | 75164,Rebel Trooper Battle Pack,https://images.brickset.com/sets/small/75164-1.jpg,Star Wars,Rogue One,2017,5.0,120,4,14.99,13.49,1743,1676 382 | 75165,Imperial Trooper Battle Pack,https://images.brickset.com/sets/small/75165-1.jpg,Star Wars,Rogue One,2017,5.0,112,4,14.99,13.49,2127,1929 383 | 75166,First Order Transport Speeder Battle Pack,https://images.brickset.com/sets/small/75166-1.jpg,Star Wars,The Force Awakens,2017,,117,,14.99,17.99,, 384 | 75167,Bounty Hunter Speeder Bike Battle Pack,https://images.brickset.com/sets/small/75167-1.jpg,Star Wars,Original Content,2017,,122,,14.99,17.99,, 385 | 75168,Yoda's Jedi Starfighter,https://images.brickset.com/sets/small/75168-1.jpg,Star Wars,The Clone Wars,2017,4.5,262,2,24.99,26.99,1786,1887 386 | 75169,Duel on Naboo,https://images.brickset.com/sets/small/75169-1.jpg,Star Wars,Episode I,2017,4.0,208,3,24.99,26.99,1623,1857 387 | 75170,The Phantom,https://images.brickset.com/sets/small/75170-1.jpg,Star Wars,Rebels,2017,4.7,269,3,29.99,35.99,1363,1811 388 | 75171,Battle on Scarif,https://images.brickset.com/sets/small/75171-1.jpg,Star Wars,Rogue One,2017,,419,4,49.99,53.99,1094,2048 389 | 75172,Y-wing Starfighter,https://images.brickset.com/sets/small/75172-1.jpg,Star Wars,Rogue One,2017,5.0,691,5,59.99,62.99,1937,2610 390 | 75173,Luke's Landspeeder,https://images.brickset.com/sets/small/75173-1.jpg,Star Wars,Episode IV,2017,3.7,149,4,19.99,17.99,1206,2107 391 | 75174,Desert Skiff Escape,https://images.brickset.com/sets/small/75174-1.jpg,Star Wars,Episode VI,2017,,277,4,29.99,35.99,840,2042 392 | 75175,A-wing Starfighter,https://images.brickset.com/sets/small/75175-1.jpg,Star Wars,Episode VI,2017,4.0,358,3,39.99,44.99,848,2397 393 | 75176,{?},,Star Wars,The Last Jedi,2017,,,,,,, 394 | 75177,{?},,Star Wars,The Last Jedi,2017,,,,,,, 395 | 75178,Jakku Quadjumper,https://images.brickset.com/sets/small/75178-1.jpg,Star Wars,The Force Awakens,2017,,457,,49.99,69.99,, 396 | 75179,{?},,Star Wars,The Last Jedi,2017,,,,,,, 397 | 75180,Rathtar Escape,https://images.brickset.com/sets/small/75180-1.jpg,Star Wars,The Force Awakens,2017,,836,,79.99,89.99,, 398 | 75182,Republic Fighter Tank,https://images.brickset.com/sets/small/75182-1.jpg,Star Wars,Episode III,2017,,305,,24.99,,, 399 | 75183,Darth Vader Transformation ,https://images.brickset.com/sets/small/75183-1.jpg,Star Wars,Episode III,2017,,282,,24.99,34.99,, 400 | 75184,Star Wars Advent Calendar,https://images.brickset.com/sets/small/75184-1.jpg,Star Wars,Seasonal,2017,,309,,39.99,,, 401 | 75185,Tracker I,https://images.brickset.com/sets/small/75185-1.jpg,Star Wars,Original Content,2017,,557,,69.99,79.99,, 402 | 75186,The Arrowhead,https://images.brickset.com/sets/small/75186-1.jpg,Star Wars,Original Content,2017,,775,,89.99,99.99,, 403 | 75187,{?},,Star Wars,The Last Jedi,2017,,,,,,, 404 | 75188,{?},,Star Wars,The Last Jedi,2017,,,,,,, 405 | 75189,{?},,Star Wars,The Last Jedi,2017,,,,,,, 406 | 75190,{?},,Star Wars,The Last Jedi,2017,,,,,,, 407 | 75191,Jedi Starfighter with Hyperdrive,https://images.brickset.com/sets/small/75191-1.jpg,Star Wars,Episode II,2017,,,,,,, 408 | 75192,{?},,Star Wars,,2017,,,,,,, 409 | 75193,{?},,Star Wars,,2017,,,,,,, 410 | 75523,Scarif Stormtrooper,https://images.brickset.com/sets/small/75523-1.jpg,Star Wars,Buildable Figures,2017,4.0,89,,24.99,22.49,601,903 411 | 75524,Chirrut Îmwe,https://images.brickset.com/sets/small/75524-1.jpg,Star Wars,Buildable Figures,2017,5.0,87,,24.99,22.49,521,825 412 | 75525,Baze Malbus,https://images.brickset.com/sets/small/75525-1.jpg,Star Wars,Buildable Figures,2017,5.0,148,,24.99,22.49,480,723 413 | 75526,{?},,Star Wars,Buildable Figures,2017,,,,,,, 414 | 75528,{?},,Star Wars,Buildable Figures,2017,,,,,,, 415 | 75529,{?},,Star Wars,Buildable Figures,2017,,,,,,, 416 | 75530,{?},,Star Wars,Buildable Figures,2017,,,,,,, 417 | 75531,Stormtrooper Commander,https://images.brickset.com/sets/small/75531-1.jpg,Star Wars,Buildable Figures,2017,,100,,24.99,29.99,, 418 | 75532,Scout Trooper & Speeder Bike,https://images.brickset.com/sets/small/75532-1.jpg,Star Wars,Buildable Figures,2017,,452,,54.99,59.99,, 419 | 75877,Mercedes-AMG GT3,https://images.brickset.com/sets/small/75877-1.jpg,Speed Champions,Mercedes,2017,4.0,196,1,14.99,14.99,926,1076 420 | 75878,Bugatti Chiron,https://images.brickset.com/sets/small/75878-1.jpg,Speed Champions,Bugatti,2017,,181,1,14.99,14.99,958,1106 421 | 75879,Scuderia Ferrari SF16-H,https://images.brickset.com/sets/small/75879-1.jpg,Speed Champions,Ferrari,2017,,,1,14.99,14.99,631,872 422 | 75880,McLaren 720S,https://images.brickset.com/sets/small/75880-1.jpg,Speed Champions,,2017,,,,14.99,,, 423 | 75881,2016 Ford GT & 1966 Ford GT40,https://images.brickset.com/sets/small/75881-1.jpg,Speed Champions,Ford,2017,5.0,366,3,29.99,34.99,754,1248 424 | 75882,Ferrari FXX K & Development Center,https://images.brickset.com/sets/small/75882-1.jpg,Speed Champions,Ferrari,2017,,494,,49.99,49.99,348,953 425 | 75883,Mercedes AMG Petronas Formula One Team,https://images.brickset.com/sets/small/75883-1.jpg,Speed Champions,Mercedes,2017,,941,8,99.99,99.99,213,915 426 | 76068,Mighty Micros: Superman vs. Bizarro,https://images.brickset.com/sets/small/76068-1.jpg,DC Comics Super Heroes,Mighty Micros,2017,,93,2,9.99,9.99,963,972 427 | 76069,Mighty Micros: Batman vs. Killer Moth,https://images.brickset.com/sets/small/76069-1.jpg,DC Comics Super Heroes,Mighty Micros,2017,,83,2,9.99,9.99,919,926 428 | 76070,Mighty Micros: Wonder Woman vs. Doomsday,https://images.brickset.com/sets/small/76070-1.jpg,DC Comics Super Heroes,Mighty Micros,2017,,85,2,9.99,9.99,885,952 429 | 76071,Mighty Micros: Spider-Man vs. Scorpion,https://images.brickset.com/sets/small/76071-1.jpg,Marvel Super Heroes,Mighty Micros,2017,,79,2,9.99,9.99,723,959 430 | 76072,Mighty Micros: Iron Man vs. Thanos,https://images.brickset.com/sets/small/76072-1.jpg,Marvel Super Heroes,Mighty Micros,2017,,94,2,9.99,9.99,1085,1178 431 | 76073,Mighty Micros: Wolverine vs. Magneto,https://images.brickset.com/sets/small/76073-1.jpg,Marvel Super Heroes,Mighty Micros,2017,,85,2,9.99,9.99,891,1094 432 | 76075,Wonder Woman Warrior Battle,https://images.brickset.com/sets/small/76075-1.jpg,DC Comics Super Heroes,DC Extended Universe,2017,,286,,29.99,34.99,31,1056 433 | 76076,Captain America Jet Pursuit,https://images.brickset.com/sets/small/76076-1.jpg,Marvel Super Heroes,Comics,2017,3.5,160,3,19.99,24.99,714,1125 434 | 76077,Iron Man: Detroit Steel Strikes,https://images.brickset.com/sets/small/76077-1.jpg,Marvel Super Heroes,Comics,2017,5.0,377,3,29.99,34.99,1114,1519 435 | 76078,Hulk vs. Red Hulk,https://images.brickset.com/sets/small/76078-1.jpg,Marvel Super Heroes,Comics,2017,2.5,375,4,59.99,,464,1400 436 | 76079,Ravager Attack,https://images.brickset.com/sets/small/76079-1.jpg,Marvel Super Heroes,Guardians of the Galaxy Vol. 2,2017,3.0,197,3,19.99,24.99,902,1185 437 | 76080,Ayesha's Revenge,https://images.brickset.com/sets/small/76080-1.jpg,Marvel Super Heroes,Guardians of the Galaxy Vol. 2,2017,4.0,323,4,29.99,34.99,944,1267 438 | 76081,The Milano vs. The Abilisk,https://images.brickset.com/sets/small/76081-1.jpg,Marvel Super Heroes,Guardians of the Galaxy Vol. 2,2017,,460,5,49.99,49.99,741,1289 439 | 76082,ATM Heist Battle,https://images.brickset.com/sets/small/76082-1.jpg,Marvel Super Heroes,Spider-Man: Homecoming,2017,,185,,19.99,29.99,, 440 | 76083,Beware the Vulture,https://images.brickset.com/sets/small/76083-1.jpg,Marvel Super Heroes,Spider-Man: Homecoming,2017,,375,,39.99,44.99,, 441 | 76084,The Ultimate Battle for Asgard,,Marvel Super Heroes,Thor: Ragnarok,2017,,,,49.99,54.99,, 442 | 76085,Battle of Atlantis,,DC Comics Super Heroes,DC Extended Universe,2017,,,,19.99,,, 443 | 76086,Knightcrawler Tunnel Attack,,DC Comics Super Heroes,DC Extended Universe,2017,,,,49.99,,, 444 | 76087,Flying Fox: Batmobile Airlift Attack,,DC Comics Super Heroes,DC Extended Universe,2017,,,,129.99,,, 445 | 76088,Thor vs. Hulk: Arena Clash,,Marvel Super Heroes,Thor: Ragnarok,2017,,,,59.99,69.99,, 446 | 853632,Batman Key Chain,https://images.brickset.com/sets/small/853632-1.jpg,Gear,Key Chains/The LEGO Batman Movie,2017,,,,4.99,4.99,82,64 447 | 853633,The Joker Key Chain,https://images.brickset.com/sets/small/853633-1.jpg,Gear,Key Chains/The LEGO Batman Movie,2017,,,,4.99,4.99,73,55 448 | 853634,Robin Key Chain,https://images.brickset.com/sets/small/853634-1.jpg,Gear,Key Chains/The LEGO Batman Movie,2017,,,,4.99,4.99,79,54 449 | 853635,Catwoman Key Chain,https://images.brickset.com/sets/small/853635-1.jpg,Gear,Key Chains/The LEGO Batman Movie,2017,,,,4.99,4.99,37,40 450 | 853636,Harley Quinn Key Chain,https://images.brickset.com/sets/small/853636-1.jpg,Gear,Key Chains/The LEGO Batman Movie,2017,,,,4.99,4.99,31,37 451 | 853637,Batman Up scaled Mug,https://images.brickset.com/sets/small/853637-1.jpg,Gear,Housewares,2017,,,,9.99,9.99,60,88 452 | 853638,Batman Minifigure Collector Frame,https://images.brickset.com/sets/small/853638-1.jpg,Gear,Storage,2017,,,,16.99,14.99,84,104 453 | 853639, Batman Tumbler,https://images.brickset.com/sets/small/853639-1.jpg,Gear,Housewares,2017,,,,7.99,7.99,22,25 454 | 853640,Batman 2x2 Lunch Box,https://images.brickset.com/sets/small/853640-1.jpg,Gear,Housewares,2017,,,,,7.99,12,31 455 | 853642,Batman Mask,https://images.brickset.com/sets/small/853642-1.jpg,Gear,Role-Play Toys,2017,,,,9.99,9.99,32,22 456 | 853644,The Joker Mask,https://images.brickset.com/sets/small/853644-1.jpg,Gear,Role-Play Toys,2017,,,,9.99,9.99,7,17 457 | 853645,Batgirl Mask,https://images.brickset.com/sets/small/853645-1.jpg,Gear,Role-Play Toys,2017,,,,9.99,9.99,9,18 458 | 853646,Harley Quinn Hammer,https://images.brickset.com/sets/small/853646-1.jpg,Gear,Role-Play Toys,2017,,,,12.99,12.99,7,12 459 | 853647,Batman Batarang,https://images.brickset.com/sets/small/853647-1.jpg,Gear,Role-Play Toys,2017,,,,7.99,7.99,72,41 460 | 853648,Roblin Bag Charm,https://images.brickset.com/sets/small/853648-1.jpg,Gear,Bag charms,2017,,,,4.99,4.99,12,12 461 | 853649, Batman Notebook with Stud Cover,https://images.brickset.com/sets/small/853649-1.jpg,Gear,Stationery,2017,,,,12.99,12.99,14,30 462 | 853650,Movie Maker Set,https://images.brickset.com/sets/small/853650-1.jpg,The LEGO Batman Movie,,2017,1.0,152,1,19.99,19.99,191,477 463 | 853651,The LEGO Batman Movie Accessory Set,https://images.brickset.com/sets/small/853651-1.jpg,The LEGO Batman Movie,,2017,,31,,12.99,12.99,1260,961 464 | 853652,Batman Minifigure Plush,https://images.brickset.com/sets/small/853652-1.jpg,Gear,Plush,2017,,,,24.99,24.99,16,66 465 | 853653,Batgirl Minifigure Plush,https://images.brickset.com/sets/small/853653-1.jpg,Gear,Plush,2017,,,,,24.99,4,37 466 | 853654,Aira the Wind Elf Key Chain,https://images.brickset.com/sets/small/853654-1.jpg,Gear,Key Chains/Elves,2017,,,,4.99,4.99,3,9 467 | 853659,City Police Handcuffs,https://images.brickset.com/sets/small/853659-1.jpg,Gear,Role-Play Toys,2017,,,,7.99,7.99,7,13 468 | 853660,The Joker Minifigure Plush,https://images.brickset.com/sets/small/853660-1.jpg,Gear,Plush,2017,,,,,24.99,4,16 469 | 853665,LEGO® Iconic Tumbler,https://images.brickset.com/sets/small/853665-1.jpg,Gear,Housewares,2017,,,,7.99,7.99,19,33 470 | 853666,Shark Suit Guy Key Chain,https://images.brickset.com/sets/small/853666-1.jpg,Gear,Key Chains/Miscellaneous,2017,,,,4.99,4.99,36,34 471 | 853667,Ballerina Key Chain,https://images.brickset.com/sets/small/853667-1.jpg,Gear,Key Chains/Miscellaneous,2017,,,,4.99,4.99,30,24 472 | 853668,Iconic Drinking Bottle,https://images.brickset.com/sets/small/853668-1.jpg,Gear,Houseware,2017,,,,,7.99,10,19 473 | 853669,LEGO Shopper Bag,https://images.brickset.com/sets/small/853669-1.jpg,Gear,Housewares,2017,,,,5.99,5.99,64,39 474 | 853676,Accessory Set,https://images.brickset.com/sets/small/853676-1.jpg,Nexo Knights,,2017,,27,,12.99,12.99,88,177 475 | 853677,Battle Pack,https://images.brickset.com/sets/small/853677-1.jpg,Nexo Knights,Battle Packs,2017,,23,,12.99,12.99,80,193 476 | 853678,Jestro s Sword,https://images.brickset.com/sets/small/853678-1.jpg,Gear,Role-Play Toys,2017,,,,12.99,9.99,1,9 477 | 853679,Forbidden Power Shield,https://images.brickset.com/sets/small/853679-1.jpg,Gear,Role-Play Toys,2017,,,,14.99,12.99,1,8 478 | 853680,Axl s Axe,https://images.brickset.com/sets/small/853680-1.jpg,Gear,Role-Play Toys,2017,,,,12.99,9.99,1,7 479 | 853681,Nexo Knights Collect and Combine Combo Powers,https://images.brickset.com/sets/small/853681-1.jpg,Gear,Storage,2017,,,,14.99,14.99,9,35 480 | 853682,Macy Key Chain,https://images.brickset.com/sets/small/853682-1.jpg,Gear,Key Chains/Nexo Knights,2017,,,,4.99,4.99,8,12 481 | 853683,Jestro Key Chain,https://images.brickset.com/sets/small/853683-1.jpg,Gear,Key Chains/Nexo Knights,2017,,,,4.99,4.99,18,21 482 | 853684,Lance Key Chain,https://images.brickset.com/sets/small/853684-1.jpg,Gear,Key Chains/Nexo Knights,2017,,,,4.99,4.99,9,15 483 | 853685,Aaron Key Chain,https://images.brickset.com/sets/small/853685-1.jpg,Gear,Key Chains/Nexo Knights,2017,,,,4.99,4.99,7,16 484 | 853686,Clay Key Chain,https://images.brickset.com/sets/small/853686-1.jpg,Gear,Key Chains/Nexo Knights,2017,,,,4.99,4.99,11,11 485 | 853687,Accessory Set,https://images.brickset.com/sets/small/853687-1.jpg,Ninjago,The Hands of Time,2017,5.0,26,3,12.99,12.99,294,423 486 | 853688,NINJAGO Time Blade Claw,https://images.brickset.com/sets/small/853688-1.jpg,Gear,Role-Play toys,2017,,,,7.99,7.99,7,17 487 | 853689,NINJAGO Vermillion Sword,https://images.brickset.com/sets/small/853689-1.jpg,Gear,Role-Play toys,2017,,,,12.99,9.99,6,16 488 | 853690,Kai Key Chain,https://images.brickset.com/sets/small/853690-1.jpg,Gear,Key Chains/Ninjago,2017,,,,4.99,4.99,15,15 489 | 853691,Kai Minifigure Plush,https://images.brickset.com/sets/small/853691-1.jpg,Gear,Plush,2017,,,,,24.99,3,24 490 | 853692, Nya Minifigure Plush,https://images.brickset.com/sets/small/853692-1.jpg,Gear,Plush,2017,,,,,24.99,3,21 491 | 3850016,Beaver,https://images.brickset.com/sets/small/3850016-1.jpg,Miscellaneous,Pick A Model,2017,,52,,,,23,27 492 | 3850017,Digger,https://images.brickset.com/sets/small/3850017-1.jpg,Miscellaneous,Pick A Model,2017,,56,,,,41,23 493 | 3850031,Puffin,https://images.brickset.com/sets/small/3850031-1.jpg,Miscellaneous,Pick A Model,2017,,50,,,,16,9 494 | 3850033,Guardsman,https://images.brickset.com/sets/small/3850033-1.jpg,Miscellaneous,Pick A Model,2017,,,,,,3,14 495 | 5004911,Crafting Kit,https://images.brickset.com/sets/small/5004911-1.jpg,Nexo Knights,Miscellaneous,2017,,16,,,,48,113 496 | 5004913,Nexo Knights Collector Case,https://images.brickset.com/sets/small/5004913-1.jpg,Gear,Storage,2017,,,,,,, 497 | 5004914,Armor Pod,https://images.brickset.com/sets/small/5004914-1.jpg,Nexo Knights,,2017,,,,,,, 498 | 5004915,Master Wu,,Gear,Key Chains/The LEGO Ninjago Movie,2017,,,,,,, 499 | 5004920,Ski Pod,https://images.brickset.com/sets/small/5004920-1.jpg,Friends,Snow Resort,2017,,,,,,, 500 | 5004928,Kiss Kiss Tuxedo Batman,https://images.brickset.com/sets/small/5004928-1.jpg,Gear,Key Chains/The LEGO Batman Movie,2017,5.0,,,,,387,684 501 | 5004929,Batman Battle Pod,https://images.brickset.com/sets/small/5004929-1.jpg,The LEGO Batman Movie,Promotional,2017,,24,1,,,202,1480 502 | 5004930,Accessory pack,https://images.brickset.com/sets/small/5004930-1.jpg,The LEGO Batman Movie,Promotional,2017,5.0,41,1,,,788,867 503 | 5004931,Birthday Card,https://images.brickset.com/sets/small/5004931-1.jpg,Promotional,,2017,,20,1,,,151,113 504 | 5004932,Travel Building Suitcase,https://images.brickset.com/sets/small/5004932-1.jpg,Miscellaneous,,2017,,41,,,,74,236 505 | 5005114,Aaron Kids Buildable Watch,https://images.brickset.com/sets/small/5005114-1.jpg,Gear,Watches/Clocks,2017,,,,24.99,,2,3 506 | 5005116,Clay Kids Buildable Watch,https://images.brickset.com/sets/small/5005116-1.jpg,Gear,Watches/Clocks,2017,,,,24.99,,1,4 507 | 5005119,Jay Kids Buildable Watch,https://images.brickset.com/sets/small/5005119-1.jpg,Gear,Watches/Clocks,2017,,,,24.99,,1,3 508 | 5005120,Lloyd Kids Buildable Watch,https://images.brickset.com/sets/small/5005120-1.jpg,Gear,Watches/Clocks,2017,,,,24.99,,1,12 509 | 5005122,Kai Kids Buildable Watch,https://images.brickset.com/sets/small/5005122-1.jpg,Gear,Watches/Clocks,2017,,,,24.99,,2,4 510 | 5005167,Stormtrooper Minifigure Link Watch,,Gear,Watches/Clocks,2017,,,,24.99,,1,13 511 | 5005175,Batman Hydration Bottle,https://images.brickset.com/sets/small/5005175-1.jpg,Gear,Housewares,2017,,,,9.99,,2,4 512 | 5005207,Batman Lunch Set,https://images.brickset.com/sets/small/5005207-1.jpg,Gear,Housewares,2017,,,,17.99,,1,5 513 | 5005208,Collector Box,https://images.brickset.com/sets/small/5005208-1.jpg,Gear,Storage,2017,,,,14.99,,13,20 514 | 5005209,Minifigure Display Case,https://images.brickset.com/sets/small/5005209-1.jpg,Gear,Storage,2017,,,,29.99,,20,33 515 | 5005212,LEGO® Star Wars™ Boba Fett™ and Darth Vader™ Link Watch,,{Undefined},,2017,,,,24.99,,0,0 516 | 5005219,Batman Minifigure Link Watch,https://images.brickset.com/sets/small/5005219-1.jpg,Gear,Watches/Clocks,2017,,,,24.99,,5,13 517 | 5005220,Robin Minifigure Link Watch,https://images.brickset.com/sets/small/5005220-1.jpg,Gear,Watches/Clocks,2017,,,,24.99,,3,11 518 | 5005222,THE LEGO® BATMAN MOVIE Batman™ Minifigure Alarm Clock,https://images.brickset.com/sets/small/5005222-1.jpg,Gear,Watches/Clocks,2017,,,,29.99,,5,6 519 | 5005223,THE LEGO® BATMAN MOVIE Robin™ Minifigure Alarm Clock,https://images.brickset.com/sets/small/5005223-1.jpg,Gear,Watches/Clocks,2017,,,,29.99,,4,8 520 | 5005224,Batgirl Minifigure Link Watch,https://images.brickset.com/sets/small/5005224-1.jpg,Gear,Watches/Clocks,2017,,,,24.99,,2,8 521 | 5005226,THE LEGO® BATMAN MOVIE Batgirl™ Minifigure Alarm Clock,https://images.brickset.com/sets/small/5005226-1.jpg,Gear,Watches/Clocks,2017,,,,29.99,,2,10 522 | 5005227,The Joker Minifigure Link Watch,https://images.brickset.com/sets/small/5005227-1.jpg,Gear,Watches/Clocks,2017,,,,24.99,,4,7 523 | 5005228,THE LEGO® BATMAN MOVIE Harley Quinn™ Minifigure Alarm Clock,https://images.brickset.com/sets/small/5005228-1.jpg,Gear,Watches/Clocks,2017,,,,29.99,,5,10 524 | 5005229,THE LEGO® BATMAN MOVIE The Joker™ Minifigure Alarm Clock,https://images.brickset.com/sets/small/5005229-1.jpg,Gear,Watches/Clocks,2017,,,,29.99,,0,7 525 | 5005299,Batgirl Key Light,https://images.brickset.com/sets/small/5005299-1.jpg,Gear,Lights,2017,,,,12.99,,4,11 526 | 5005301,Harley Quinn Key Light,https://images.brickset.com/sets/small/5005301-1.jpg,Gear,Lights,2017,,,,12.99,,9,12 527 | 5005317,Easter Bunny Batman Key Light,,Gear,Lights,2017,,,,12.99,,7,9 528 | 5005320,Batman Prestige Costume,https://images.brickset.com/sets/small/5005320-1.jpg,Gear,Clothing,2017,,,,69.99,,1,6 529 | 5005321,Batgirl Prestige Costume,https://images.brickset.com/sets/small/5005321-1.jpg,Gear,Clothing,2017,,,,69.99,,0,3 530 | 5005322,LEGO Star Wars Chewbacca Link Watch,,{Undefined},,2017,,,,,,0,0 531 | 5005332,LEGO Star Wars Boba Fett and Darth Vader Link Watch,,{Undefined},,2017,,,,,,0,0 532 | 5005333,Batman Minifigure Link Watch,,Gear,Watches/Clocks,2017,,,,,24.99,0,3 533 | 5005334,Robin Minifigure Link Watch,https://images.brickset.com/sets/small/5005334-1.jpg,Gear,Watches/Clocks,2017,,,,,24.99,1,4 534 | 5005335,Batman Minifigure Alarm Clock,https://images.brickset.com/sets/small/5005335-1.jpg,Gear,Watches/Clocks,2017,,,,,29.99,3,6 535 | 5005336,Batgirl Minifigure Link Watch,https://images.brickset.com/sets/small/5005336-1.jpg,Gear,Watches/Clocks,2017,,,,,24.99,2,4 536 | 5005337,The Joker Minifigure Link Watch,https://images.brickset.com/sets/small/5005337-1.jpg,Gear,Watches/Clocks,2017,,,,,24.99,0,4 537 | 5005338,Harley Quinn Minifigure Alarm Clock,https://images.brickset.com/sets/small/5005338-1.jpg,Gear,Watches/Clocks,2017,,,,,29.99,5,10 538 | 5005345,Ultimate Vehicle Kit,https://images.brickset.com/sets/small/5005345-1.jpg,The LEGO Batman Movie,Virtual Product Collection,2017,,1014,,,99.99,23,114 539 | ,Batman,https://images.brickset.com/sets/small/BAT211701-1.jpg,The LEGO Batman Movie,Magazine Gift,2017,,8,,,,537,429 540 | ,The Joker,https://images.brickset.com/sets/small/BAT211702-1.jpg,The LEGO Batman Movie,Magazine Gift,2017,,,,,,190,62 541 | ,Detention Block Rescue,https://images.brickset.com/sets/small/CELEB2017-1.jpg,Star Wars,,2017,,220,2,,,54,481 542 | ,Policeman and crook,https://images.brickset.com/sets/small/CITY951701-1.jpg,City,Magazine Gift,2017,,,,,,289,115 543 | ,Workman and wheelbarrow,https://images.brickset.com/sets/small/CITY951702-1.jpg,City,Magazine Gift,2017,,,,,,57,47 544 | ,Mr. Spry and His Lemonade Stand,https://images.brickset.com/sets/small/ELV241701-1.jpg,Elves,Magazine Gift,2017,,,,,,22,59 545 | ,Bear in Cave,https://images.brickset.com/sets/small/FR561701-1.jpg,Friends,Magazine gift,2017,,,,,,113,61 546 | ,Kitten Felix,https://images.brickset.com/sets/small/FR561702-1.jpg,Friends,Magazine gift,2017,,,,,,80,37 547 | ,Fruit Bar,https://images.brickset.com/sets/small/FR561703-1.jpg,Friends,Magazine gift,2017,,,,,,13,21 548 | ,The LEGO BATMAN MOVIE: The Making of the Movie,https://images.brickset.com/sets/small/ISBN0241279585-1.jpg,Books,Dorling Kindersley,2017,5.0,,,24.99,,97,90 549 | ,"How to Build Brick Cars: Detailed LEGO Designs for Sports Cars, Race Cars, and Muscle Cars",https://images.brickset.com/sets/small/ISBN0760352658-1.jpg,Books,Motorbooks,2017,,,,,,1,69 550 | ,The LEGO Batman Movie: Chaos in Gotham City,https://images.brickset.com/sets/small/ISBN1338112120-1.jpg,Books,Scholastic,2017,,6,1,8.99,,, 551 | ,Brick Buildings: 40 Clever & Creative Ideas to Make from Classic LEGO,https://images.brickset.com/sets/small/ISBN1438010923-1.jpg,Books,Barron's Educational Series,2017,,,,,,2,55 552 | ,Ultimate LEGO Star Wars: Characters Creatures Locations Technology Vehicles,,Books,Dorling Kindersley,2017,,,,,,1,52 553 | ,The LEGO BATMAN MOVIE: The Essential Guide,https://images.brickset.com/sets/small/ISBN1465456333-1.jpg,Books,Dorling Kindersley,2017,,,,12.99,,39,34 554 | ,DC Comics Super Heroes: The Awesome Guide,https://images.brickset.com/sets/small/ISBN1465460780-1.jpg,Books,Dorling Kindersley,2017,,,,16.99,,30,184 555 | ,NEXO KNIGHTS Build Your Own Adventure,https://images.brickset.com/sets/small/ISBN146546087X-1.jpg,Books,Dorling Kindersley,2017,,0,,,,2,83 556 | ,DC Comics Super Heroes Build Your Own Adventure,,Books,Dorling Kindersley,2017,,,,,,6,125 557 | ,The LEGO NINJAGO MOVIE: The Essential Guide,,Books,Dorling Kindersley,2017,,,,12.99,,1,23 558 | ,The LEGO NINJAGO MOVIE: The Making of the Movie,,Books,Dorling Kindersley,2017,,,,,,1,32 559 | ,NEXO KNIGHTS Character Encyclopedia,,Books,Dorling Kindersley,2017,,,,,,1,38 560 | ,The LEGO BATMAN MOVIE: The Essential Collection,,Books,Dorling Kindersley,2017,,,,19.99,,1,35 561 | ,LEGO: Absolutely Everything You Need to Know,,Books,Dorling Kindersley,2017,,,,,,1,41 562 | ,Build It! Things That Fly,https://images.brickset.com/sets/small/ISBN1513260529-1.jpg,Books,Graphic Arts Books,2017,,,,,,4,32 563 | ,Build It! Things That Float,https://images.brickset.com/sets/small/ISBN1513260553-1.jpg,Books,Graphic Arts Books,2017,,,,,,4,31 564 | ,Build It! Things That Go,https://images.brickset.com/sets/small/ISBN1513260588-1.jpg,Books,Graphic Arts Books,2017,,,,,,4,33 565 | ,"The LEGO Adventure Book, Vol. 4: Monsters, Mecha & More!",https://images.brickset.com/sets/small/ISBN1593277636-1.jpg,Books,No Starch Press,2017,,,,,,4,269 566 | ,Epic LEGO Adventures with Bricks You Already Have,https://images.brickset.com/sets/small/ISBN1624143865-1.jpg,Books,Page Street Publishing,2017,,,,,,3,64 567 | ,Building Amazing Creations: Sean Kenney's Art with Lego Bricks,https://images.brickset.com/sets/small/ISBN1627790187-1.jpg,Books,Henry Holt & Co.,2017,,,,,,3,65 568 | ,Beasts from Bricks: Amazing LEGO Designs for Animals from Around the World,https://images.brickset.com/sets/small/ISBN1631592998-1.jpg,Books,Quarry,2017,,,,,,3,114 569 | ,The Streets of Brickingdon,https://images.brickset.com/sets/small/ISBN1911113879-1.jpg,Books,Spiderwize,2017,5.0,,,,,5,64 570 | ,"Tips, Tricks & Building Techniques: The Big Unofficial LEGO Builders Book",https://images.brickset.com/sets/small/ISBN3958434797-1.jpg,Books,Heel-Verlag,2017,,,,,,9,65 571 | ,LEGO Tips for Kids: Minions ,https://images.brickset.com/sets/small/ISBN3958434940-1.jpg,Books,Heel-Verlag,2017,,,,,,1,49 572 | ,LEGO Tips for Kids: Transformers,https://images.brickset.com/sets/small/ISBN3958434959-1.jpg,Books,Heel-Verlag,2017,,,,,,1,118 573 | ,Mini Batmobile,https://images.brickset.com/sets/small/MINIBATMOBILE-1.jpg,The LEGO Batman Movie,Promotional,2017,,,,,,19,72 574 | ,Clay,https://images.brickset.com/sets/small/NEX271712-1.jpg,Nexo Knights,Magazine Gift,2017,,,,,,237,85 575 | ,Merlok 2.0,https://images.brickset.com/sets/small/NEX271713-1.jpg,Nexo Knights,Magazine Gift,2017,,,,,,176,93 576 | ,Robin,https://images.brickset.com/sets/small/NEX271714-1.jpg,Nexo Knights,Magazine Gift,2017,,,,,,, 577 | ,Lance's Cart,https://images.brickset.com/sets/small/NEX271715-1.jpg,Nexo Knights,Magazine Gift,2017,,,,,,24,22 578 | ,Jay,https://images.brickset.com/sets/small/NIN891721-1.jpg,Ninjago,Magazine Gift,2017,,,,,,228,47 579 | ,Cole,https://images.brickset.com/sets/small/NIN891722-1.jpg,Ninjago,Magazine Gift,2017,,,,,,161,41 580 | ,Kai,https://images.brickset.com/sets/small/NIN891723-1.jpg,Ninjago,Magazine Gift,2017,,,,,,, 581 | ,Zane,https://images.brickset.com/sets/small/NIN891724-1.jpg,Ninjago,Magazine Gift,2017,,,,,,72,24 582 | ,Lloyd,,Ninjago,Magazine Gift,2017,,,,,,0,0 583 | ,Flash Speeder,https://images.brickset.com/sets/small/SW911618-1.jpg,Star Wars,Magazine Gift,2017,,,,,,432,191 584 | ,Kanan Jarrus,https://images.brickset.com/sets/small/SW911719-1.jpg,Star Wars,Magazine Gift,2017,,,,,,703,231 585 | ,The Ghost,https://images.brickset.com/sets/small/SW911720-1.jpg,Star Wars,Magazine Gift,2017,,,,,,411,180 586 | ,Imperial Combat Driver,https://images.brickset.com/sets/small/SW911721-1.jpg,Star Wars,Magazine Gift,2017,,,,,,480,167 587 | ,TIE Advanced,https://images.brickset.com/sets/small/SW911722-1.jpg,Star Wars,Magazine Gift,2017,,,,,,236,84 588 | ,Vulture Droid,,Star Wars,Magazine Gift,2017,,,,,,0,0 589 | ,Flying Batmobile,https://images.brickset.com/sets/small/TRUBATMOBILE-1.jpg,The LEGO Batman Movie,Promotional,2017,,,,,,400,218 590 | ,Monster,https://images.brickset.com/sets/small/TRUNEXOMONSTER-1.jpg,Nexo Knights,Miscellaneous,2017,,,,,,77,72 591 | --------------------------------------------------------------------------------