摘要: 目标是爬取网站http://www.muyingzhijia.com/上全部的商品数据信息,包括商品的一级类别,二级类别,商品title,品牌,价格。搜索了一下,python的scrapy是一个不错的爬虫框架,于是基于scrapy写了一个简易的爬虫。先分析商品页面,在http://www.muyingzhijia.com/主页面上,有类链接有用的链接,即:http://www.muyingzhijia.com/Shopping/category.aspx?cateID=11和http://www.muyingzhijia.com/Shopping/subcategory.aspx?cateID 阅读全文
posted @ 2013-12-14 20:26 darlwen 阅读(562) 评论(0) 推荐(0) 编辑
摘要: 给定一串由0, 1, ?组成的字符,如"0?10?00", 用0或1替换其中的问号,列举出所有可能的情况。看到这个题首先反应的是用递归,代码如下:#include #include #include using namespace std;void strTrans(string str, int idx, vector& res){ if(idx == str.length()) { res.push_back(str); return; } if(str[idx] == '?') { str[idx] = '0'; ... 阅读全文
posted @ 2013-12-04 20:41 darlwen 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 今天尝试用template完成一个循环链表,期间几费周折,将遇到的问题记录一下。这是最后完成的circleList.hpp文件。#ifndef CIRCLELIST_HPP_#define CIRCLELIST_HPP_template class CircleList;template class CNode { private: T elem; CNode* next; friend class CircleList;};template class CircleList { public: CircleList(); ~CircleList(); bool empty() ... 阅读全文
posted @ 2013-11-24 21:48 darlwen 阅读(278) 评论(0) 推荐(0) 编辑