加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
v2ex.py 527 Bytes
一键复制 编辑 原始数据 按行查看 历史
mktime 提交于 2014-10-09 16:25 . execute
#!/bin/env python
from pymongo import MongoClient
import time
c = MongoClient()
db = c['v2ex']
cur_time = time.time() - 8 * 60 * 60
cur = db.topic.find({"created":{"$gt":cur_time}, "replies":{"$gt":0}}).sort("replies", -1).limit(8)
data = cur.next()
for data in cur:
print 80 * '-'
print "reply count:", data['replies']
print "url:", data['url']
print "create time:", time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(data['created']))
print "title:", data['title']
print "content:", data['content']
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化