示例#1
0
文件: views.py 项目: vaneoooo/SailYX
 def gWeather(self):
     weather = weatherspider()
     s = ''
     for w in weather:
         s += w[0]
         s += '\b\n'
         s += w[1]
         s += '\b\n'
     return (s)
示例#2
0
文件: views.py 项目: vaneoooo/SailYX
 def gWeather(self):
     if mc:
         if mc.get('weather'):
             return mc.get('weather')
     import re
     weather = weatherspider()
     s = ''
     date = re.compile('(?P<date>\d+:\d\d)')
     for w in weather:
         s += w[0]
         s += '\b\n'
         s += w[1]
         s += '\b\n'
         s = date.sub(lambda m: m.groups()[0] + '\n\n', s)
         s = s.replace(' ','')
     if not mc:
         return (s)
     mc.set('weather',s,time=3600)
     return (mc.get('weather'))