1 Star 0 Fork 265

ghostxyj/project_19802442

forked from mktime/python-learn 
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
v2ex.py 527 Bytes
Copy Edit Raw Blame History
mktime authored 2014-10-09 16:25 +08:00 . 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 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/ghostxyj/python-learn.git
git@gitee.com:ghostxyj/python-learn.git
ghostxyj
python-learn
project_19802442
master

Search