![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
文章平均质量分 87
IT衡
这个作者很懒,什么都没留下…
展开
-
python count(), lower(), ord(), chr(), isalpha()
Question:You are given a text, which contains different english letters and punctuation symbols. You should find the most frequent letter in the text. The letter returned must be in lower case.原创 2016-01-06 14:20:51 · 1636 阅读 · 0 评论 -
Appstore proj: Calculate an App's Top-5 related apps(2)
Save data into MongoDBinstead of print, we do persistpersist top 5 recommended apps in app_info1. Persist top 5 apps in MongoDB2. Do it for all apps loop through all apps, ge原创 2016-01-12 11:55:23 · 486 阅读 · 0 评论 -
python isinstance(), stack,判断list, dict, tuple为空
Problem:Nikola likes to categorize everything in sight. One time Stephan gave him a label maker for his birthday, and the robots were peeling labels off of every surface in the ship for weeks. H原创 2016-01-12 07:16:19 · 10565 阅读 · 0 评论 -
Mac OS install mongodb
1. install mongodb>>> brew install mongodb2. create data directory>>> sudo mkdir -p /data/db3. set permission for data directory>>> sudo chmod -R 777/data4. run mongodb in frond ground(会停在原创 2016-01-10 20:22:04 · 470 阅读 · 0 评论 -
Using Databases with Python -Musical Track Database (produce database from XML file)
This application will read an iTunes export file in XML and produce a properly normalized database with this structure:CREATE TABLE Artist ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE原创 2016-01-11 18:55:25 · 6539 阅读 · 0 评论 -
Using Databases with Python - Many students in many courses (produce database from json file)
This application will read roster data in JSON format, parse the file, and then produce an SQLite database that contains a User, Course, and Member table and populate the tables from the data file.D原创 2016-01-11 19:08:01 · 2976 阅读 · 2 评论 -
Using Databases with Python-Counting Organizations
Counting OrganizationsThis application will read the mailbox data (mbox.txt) count up the number email messages per organization (i.e. domain name of the email address) using a database with the fol原创 2016-01-11 18:40:02 · 6738 阅读 · 0 评论 -
Crawler爬虫实例:huawei appstore
1. create a scrapy project>>> scrapy startproject appstore2. define extracted data schemaedit appstore/appstore/items.py, add the following:import scrapyclass AppstoreItem(scrapy.Item):原创 2016-01-09 17:40:38 · 2708 阅读 · 0 评论 -
Scrapy 示例 —— Web 爬虫框架
英文原文:Scrapy demo译者:skyim原文:http://www.oschina.net/translate/scrapy-demo在这个教材中,我们假定你已经安装了Scrapy。假如你没有安装,你可以参考这个安装指南。我们将会用开放目录项目(dmoz)作为我们例子去抓取。这个教材将会带你走过下面这几个方面:创造一个新的Scrapy项目定义您将提取的Item编写一个蜘转载 2016-01-09 14:33:03 · 1107 阅读 · 0 评论 -
在Mac OS El Capitan下用pip安装Scrapy 失败
环境:同时安装了Python 2.7,Python 3.4使用 安装命令 pip install Scrapy下载正常安装时出错:Installing collected packages: Scrapy, six, queuelib, lxml, w3lib, cssselectCleaning up...Exception:Traceback (most recen原创 2016-01-09 13:18:08 · 2303 阅读 · 0 评论 -
python join(), bool(), strip(), dict()
Question:Stephen's speech module is broken. Thismodule is responsible for his number pronunciation. He has to click to inputall of the numerical digits in a figure, so when there are big numbers it原创 2016-01-09 08:33:31 · 736 阅读 · 0 评论 -
python zip(), map()
Question:Tic-Tac-Toe, sometimes also known as Xs andOs, is a game for two players (X and O) who take turns marking the spaces in a3×3 grid. The player who succeeds in placing three respective marks原创 2016-01-07 09:47:51 · 536 阅读 · 0 评论 -
Appstore proj: Calculate an App's Top-5 related apps(1)
How to calculate similarity?use cosine similarity!Edit helper.py.So you can call the function in helper class when needed>>> helper = Helper()similarity = helper.cosine_simil原创 2016-01-12 11:01:57 · 597 阅读 · 0 评论