
python
它山之石,可以攻玉
工欲善其事,必先利其器。
展开
-
python模仿浏览器访问网站
#coding:utf-8import randomimport socketimport urllib2import cookielibERROR = { '0':'Can not open the url,checck you net', '1':'Creat download dir error', '2':'Th原创 2016-11-29 14:26:14 · 2876 阅读 · 0 评论 -
python 批量爬取博客数据(仅供学习)
#coding:utf-8 import urllib import time import ospage=1 while page<=7: url=['']*50 temp='http://blog.sina.com.cn/s/articlelist_1191258123_0_'+str(page)+'.html' con =urllib.urlop原创 2016-11-29 15:54:01 · 1009 阅读 · 1 评论 -
python socket实现简单的(TCP/UDP)服务器/客户端
1、创建服务端# -*- coding: utf-8 -*- from socket import * from time import ctime HOST = 'localhost' #主机名 PORT = 9999 #端口号 BUFSIZE = 1024 #缓冲区大小1K ADDR原创 2016-12-01 14:23:34 · 2783 阅读 · 0 评论 -
python中date、datetime、string的相互转换
python 时间的处理原创 2016-12-01 16:01:42 · 2126 阅读 · 0 评论 -
python 操作mysql数据库(简单/基础)
1、配置MySLQ 1-1:安装mysql windows 安装mysql5.7 1-2:安装python依赖mysql模块 pip install mysql 安装Python的MySQL库,但是总会报错。 常见错误如: Microsoft Visual C++原创 2016-12-01 17:14:29 · 469 阅读 · 0 评论 -
python模拟浏览器访问网站
import os import urllib class AppURLopener(urllib.FancyURLopener): version = "Mozilla/5.0" urllib._urlopener = AppURLopener() url = "http://blog.youkuaiyun.com/eastmount/article/details/444927原创 2016-11-29 20:37:50 · 3879 阅读 · 0 评论 -
Python中的正则表达式教程
Python中的正则表达式的相关内容。正则表达式在Python爬虫中的作用就像是老师点名时用的花名册一样,是必不可少的神兵利器。以下内容转自CNBLOG:http://www.cnblogs.com/huxi/archive/2010/07/04/1771073.html整理时没有注意,实在抱歉。一、 正则表达式基础1.1.概念介绍正则表达式是用转载 2016-12-02 09:40:03 · 383 阅读 · 1 评论