python @ http://alvinalexander.com/python/python-feedparser-script-linux-screensaver-time-exec-syste
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python @ http://alvinalexander.com/python/python-feedparser-script-linux-screensaver-time-exec-syste相关的知识,希望对你有一定的参考价值。
#!/usr/bin/python
#
# from http://www.pythonforbeginners.com/feedparser/using-feedparser-in-python
# installed feedparser with `pip`, after installing pip with apt-get
#
import feedparser
import time
from subprocess import check_output
# ------
# uptime
# ------
uptime = check_output(['uptime'])
print "\n"
print '-------------------------------------------------------------'
print uptime.strip()
print '-------------------------------------------------------------'
print "\n"
# --------------------
# tribune (feedparser)
# --------------------
d = feedparser.parse('http://chicagotribune.feedsportal.com/c/34253/f/622872/index.rss')
# print all posts
count = 1
blockcount = 1
for post in d.entries:
if count % 5 == 1:
print "\n" + time.strftime("%a, %b %d %I:%M %p") + ' ((( TRIBUNE - ' + str(blockcount) + ' )))'
print "-----------------------------------------\n"
blockcount += 1
print post.title + "\n"
count += 1
以上是关于python @ http://alvinalexander.com/python/python-feedparser-script-linux-screensaver-time-exec-syste的主要内容,如果未能解决你的问题,请参考以下文章
Python代写,Python作业代写,代写Python,代做Python
Python开发
Python,python,python
Python 介绍
Python学习之认识python
python初识