128 Star 564 Fork 216

mktime / python-learn

加入 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']
Python
1
https://gitee.com/mktime/python-learn.git
git@gitee.com:mktime/python-learn.git
mktime
python-learn
python-learn
master

搜索帮助