python爬虫: 豆瓣电影top250数据分析
转载博客 https://segmentfault.com/a/1190000005920679
根据自己的环境修改并配置mysql数据库
系统:Mac OS X 10.11
python 2.7
mysql安装
使用brew安装mysql,启动mysql服务
☁ ~ brew install mysql
Warning: mysql-5.7.18 already installed
☁ ~ which mysql
/usr/local/bin/mysql
☁ ~ ls /usr/local/bin/mysql*
/usr/local/bin/mysql /usr/local/bin/mysql_ssl_rsa_setup /usr/local/bin/mysqldumpslow
/usr/local/bin/mysql.server /usr/local/bin/mysql_tzinfo_to_sql /usr/local/bin/mysqlimport
/usr/local/bin/mysql_client_test /usr/local/bin/mysql_upgrade /usr/local/bin/mysqlpump
/usr/local/bin/mysql_client_test_embedded /usr/local/bin/mysqladmin /usr/local/bin/mysqlshow
/usr/local/bin/mysql_config /usr/local/bin/mysqlbinlog /usr/local/bin/mysqlslap
/usr/local/bin/mysql_config_editor /usr/local/bin/mysqlcheck /usr/local/bin/mysqltest
/usr/local/bin/mysql_embedded /usr/local/bin/mysqld /usr/local/bin/mysqltest_embedded
/usr/local/bin/mysql_install_db /usr/local/bin/mysqld_multi /usr/local/bin/mysqlxtest
/usr/local/bin/mysql_plugin /usr/local/bin/mysqld_safe
/usr/local/bin/mysql_secure_installation /usr/local/bin/mysqldump
☁ ~ mysql.server start
Starting MySQL
. SUCCESS!
数据库创建,表创建
☁ ~ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.18 Homebrew Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| alt_web |
| db_name |
| db_tendenci |
| douban |
| mysql |
| performance_schema |
| sys |
| testdb1 |
+--------------------+
9 rows in set (0.00 sec) mysql>create douban; #创建douban数据库
mysql>use douban; #更换当前数据库
#在douban数据库中,创建表douban
mysql>create table douban(
id INT NOT NULL AUTO_INCREMENT,
class VARCHAR(100) NOT NULL,
count INT NOT NULL,
PRIMARY KEY( id )
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
mysql> desc douban; #显示表结构
+-------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| class | varchar(100) | NO | | NULL | |
| count | int(11) | NO | | NULL | |
+-------+--------------+------+-----+---------+----------------+
3 rows in set (0.01 sec)
mysql教程
python包安装
requests,lxml.etree,pymysql,matplotlib
- 使用pip安装
pip install packagename
下载源代码并运行
$ python demo.py
我的源码
https://github.com/MingjaLee/spiders_douban_movies
python爬虫: 豆瓣电影top250数据分析的更多相关文章
- python pandas 豆瓣电影 top250 数据分析
豆瓣电影top250数据分析 数据来源(豆瓣电影top250) 爬虫代码比较简单 数据较为真实,可以进行初步的数据分析 可以将前面的几篇文章中的介绍的数据预处理的方法进行实践 最后用matplotli ...
- [Python]计算豆瓣电影TOP250的平均得分
用python写的爬虫练习,感觉比golang要好写一点. import re import urllib origin_url = 'https://movie.douban.com/top250? ...
- Python爬虫-豆瓣电影 Top 250
爬取的网页地址为:https://movie.douban.com/top250 打开网页后,可观察到:TOP250的电影被分成了10个页面来展示,每个页面有25个电影. 那么要爬取所有电影的信息,就 ...
- python爬虫-豆瓣电影的尝试
一.背景介绍 1. 使用工具 Pycharm 2. 安装的第三方库 requests.BeautifulSoup 2.1 如何安装第三方库 File => Settings => Proj ...
- python爬虫 Scrapy2-- 爬取豆瓣电影TOP250
sklearn实战-乳腺癌细胞数据挖掘(博主亲自录制视频) https://study.163.com/course/introduction.htm?courseId=1005269003& ...
- Python爬虫----抓取豆瓣电影Top250
有了上次利用python爬虫抓取糗事百科的经验,这次自己动手写了个爬虫抓取豆瓣电影Top250的简要信息. 1.观察url 首先观察一下网址的结构 http://movie.douban.com/to ...
- Python小爬虫——抓取豆瓣电影Top250数据
python抓取豆瓣电影Top250数据 1.豆瓣地址:https://movie.douban.com/top250?start=25&filter= 2.主要流程是抓取该网址下的Top25 ...
- Python爬虫入门:爬取豆瓣电影TOP250
一个很简单的爬虫. 从这里学习的,解释的挺好的:https://xlzd.me/2015/12/16/python-crawler-03 分享写这个代码用到了的学习的链接: BeautifulSoup ...
- [Python] 豆瓣电影top250爬虫
1.分析 <li><div class="item">电影信息</div></li> 每个电影信息都是同样的格式,毕竟在服务器端是用 ...
随机推荐
- 定位之float 同一父元素的float相互影响,float是margin盒子在父元素的padding盒子内
- day9函数作业详解
1.day9题目 1,整理函数相关知识点,写博客. 2,写函数,检查获取传入列表或元组对象的所有奇数位索引对应的元素,并将其作为新列表返回给调用者. 3,写函数,判断用户传入的对象(字符串.列表.元组 ...
- css 文本溢出时显示省略号
.text-ellipsis { width:100px; height:60px; overflow: hidden;//隐藏滚动条 text-overflow:ellipsis; white-sp ...
- Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined) B
Bash has set out on a journey to become the greatest Pokemon master. To get his first Pokemon, he we ...
- UVa1471
保留有价值的数字的做法,实际上这道题因为n只有1e5,所以不需要这种优化. #include<bits/stdc++.h> #define inf 0x3f3f3f3f ; using n ...
- 前端CSS(3)
前端基础CSS(3) 一.文本属性和字体属性(常用的) 1.文本属性 text-align:left|right|center|justify(两端对齐,只适用于英文); /*对齐方式*/ c ...
- (转)Centos 7.3 用户和组管理
Centos 7.3 用户和组管理 原文:http://blog.csdn.net/github_39069288/article/details/73306489 3.1 用户和密码配置文件 pas ...
- 轻量级的绘制图表js库--Morris.js
Morris.js 是一个轻量级的 JS 库,使用 jQuery 和 Raphaël 来生成各种时序图. 虽说现在移动手机网络已经到了4G,但是在移动web客户端开发过中,为了达到良好的体验效果,需要 ...
- Redis sorted set(有序集合)
Redis 有序集合是string类型元素的集合,元素不允许重复. 有序集合中的每个元素都会关联一个数值型的分数.redis正是通过分数来为集合中的成员进行从小到大的排序. 有序集合的成员是唯一的(不 ...
- Locust安装教程与使用
Locust安装教程与使用官网地址:https://github.com/locustio/locust 如果是python3+以上的环境,需要下载locust项目源码进行安装 因Centos7.2环 ...