我一直在玩 Python 和 geektools,在我整理代码和使用循环之前,我已经让脚本工作了。
现在它不会显示超出该lalala
方法的任何内容。
我正在使用 geektools 3.0.2 在 mac 10.8.1 上工作。
#!/usr/bin/python
#Simple script that downloads runescape adventures log
#and outputs it to console
# Ashley Hughes 16/SEP/2012
import sys
import urllib2 #For HTTP access
from time import localtime, strftime #Time data functions
from xml.dom.minidom import parseString #XML parser
def lalala(n):
i = 0
while(i <= n):
xmlTag = dom.getElementsByTagName('description')[i].toxml()
xmlData = xmlTag.replace('<description>','').replace('</description>','').replace('\t','').replace('\n','')
#print (str(i) + ": " + xmlData)
print(xmlData)
i = i + 1
try:
f = urllib2.urlopen("http://services.runescape.com/m=adventurers-log/rssfeed?searchName=SIG%A0ZerO")
#f = urllib.urlopen("http://www.runescape.com/")
except Exception, e:
print "Could not connect"
sys.exit(1)
s = f.read()
f.close()
dom = parseString(s)
print strftime("%a, %d %b %Y %H:%M:%S", localtime())
print "Working"
lalala(6)
print "Still working"
sys.exit(0)