OJ升级,代码可能会丢失. 所以要事先备份. 一开始傻傻的复制粘贴, 后来实在不能忍, 得益于大潇的启发和聪神的原始代码, 网页爬虫走起!
已经有段时间没看Python, 这次网页爬虫的原始代码是 python2.7版本, 试了一下修改到3.0版本, 要做很多包的更替,感觉比较烦,所以索性就在这个2.7版本上完善了.
首先观赏一下原始代码,我给加了一些注释:
# -*-...
分类:
编程语言 时间:
2014-05-15 02:39:45
阅读次数:
439
大家都知道,在java中的集合Map中按键值key排序比较简单,只需引用集合TreeMap即可,可是怎样实现按value值排序呢?下面我们来测试一下:
public class TestHashMap {
public static void main(String[] args) {
Map map = new HashMap();
map.put("zhangsan", 1);
...
分类:
其他好文 时间:
2014-05-15 02:37:34
阅读次数:
263
string库中所有的字符索引从前往后是1,2,...;从后往前是-1,-2,...string库中所有的function都不会直接操作字符串,而是返回一个结果...
分类:
其他好文 时间:
2014-05-14 21:44:00
阅读次数:
346
【题目】
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype shoul...
分类:
其他好文 时间:
2014-05-14 21:36:52
阅读次数:
348
为Python添加默认模块搜索路径
方法一:函数添加
1) import sys
2) 查看sys.path
3) 添加sys.path.append("c:\\")
方法二:修改环境变量
windows用户可以修改系统环境变量PYTHONPATH
方法三:增加.pth文件,推荐!
在site-packages添加一个路径文件,如mypkpath.pth,必须以...
分类:
编程语言 时间:
2014-05-14 21:21:27
阅读次数:
419
【题目】
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases.
Notes: It is intended for this problem to be s...
分类:
其他好文 时间:
2014-05-14 21:00:57
阅读次数:
304
http://acm.hdu.edu.cn/showproblem.php?pid=1224
基础的求最长路以及记录路径。感觉dijstra不及spfa好用,wa了两次。
#include
#include
#include
#include
#include
#include
#include
#include
#define LL long long
#define...
分类:
其他好文 时间:
2014-05-14 20:59:54
阅读次数:
295
控制台钢琴小程序
static void Main(string[] args)
{
WindowsMediaPlayer wmp = new WindowsMediaPlayer();
wmp.URL=@"f:\all of musics\kukuku\hisaishi joe - ballade.mp3";...
分类:
其他好文 时间:
2014-05-14 20:28:08
阅读次数:
257
众所周知,在android系统上,有时候我们遇到so文件的crash只能打log,但是很多时候并不知道crash在什么地方,幸运的是crash后,一般可以产生一个.dmp文件。
我们可以根据这个文件来得到更为详细的statck trace。
主要用的就是google提供的一些方法,命令太复杂,很容易出错,所以我写了一个python脚本,简化步骤。
详情可以参考 https://code.go...
分类:
移动开发 时间:
2014-05-14 19:45:57
阅读次数:
454