Created
August 22, 2013 12:56
-
-
Save Chairo/6306780 to your computer and use it in GitHub Desktop.
Python搭建BT资源搜索站(二)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
from pymongo import Connection #引入Mongo支持 | |
#连接Mongo | |
mongo = Connection(host='127.0.0.1', port=27017) | |
db = mongo.bt #连接bt这个数据库,没有会自动新建 | |
#读取下载的文件内容 | |
def read_data(): | |
_file = open('20130820.txt', 'rb').readlines() | |
for _item in _file: | |
db.info_hash.insert({"info_hash":_item}) | |
if __name__ == "__main__": | |
read_data() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment