- 博客(6)
- 收藏
- 关注
原创 Python爬虫入门之爬取图片
import requests import os url = input("Please input URL\n") root = "D://pics//" kv = { "User-agent":"Mozilla/5.0" } path = root + url.split('/')[-1] #本地存储目录 try: if not os.path.exists(root):
2018-02-09 15:49:31 410
原创 Python爬虫入门之查询ip地址
import requests url = "http://m.ip138.com/ip.asp?ip=" IpAddress = input("Please input the ip address\n") try: r = requests.get(url+IpAddress) r.raise_for_status() r.encoding = r.apparent_encoding ...
2018-02-09 15:43:43 1739
原创 Python爬虫入门之get网页信息并作为文本输出
import requests import os kv = { "User-agent":"Mozilla/5.0"#模拟浏览器 } def getHtmlText(url): try: r = requests.get(url,timeout = 30,headers = kv) r.raise_for_status() r.encoding = r.appare...
2018-02-09 15:43:00 2627
原创 Checker
AtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K. Here, a checked pattern of side K is a pattern where each square is painted black or white so that eac
2018-02-04 21:06:32 390
原创 Manacher模板
#define MAXN 1000005 char s[MAXN];//原字符串 char New[2*MAXN];//处理过后得到的新字符串 int p[2*MAXN];//记录以每个字符为中心的最长回文长度+1,注意是+1后的结果 //这里为什么多出1一定要想明白,很重要。 int Manacher(int len) { int id = 0; int mx = 0; ...
2018-02-01 13:41:26 135
原创 POJ3974——Palindrome
Andy the smart computer science student was attending an algorithms class when the professor asked the students a simple question, "Can you propose an efficient algorithm to find the length of the larg
2018-02-01 13:35:45 226
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人