Skip to content

Instantly share code, notes, and snippets.

@Chairo
Created August 22, 2013 12:56
Show Gist options
  • Save Chairo/6306780 to your computer and use it in GitHub Desktop.
Save Chairo/6306780 to your computer and use it in GitHub Desktop.
Python搭建BT资源搜索站(二)
# -*- 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