本文整理汇总了Python中weather.Weather.get_temp方法的典型用法代码示例。如果您正苦于以下问题:Python Weather.get_temp方法的具体用法?Python Weather.get_temp怎么用?Python Weather.get_temp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weather.Weather
的用法示例。
在下文中一共展示了Weather.get_temp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from weather import Weather [as 别名]
# 或者: from weather.Weather import get_temp [as 别名]
def get(self, time):
(_, measured_temp, city_url) = Weather.get_temp('Skopje')
record = Record()
record.temperature = measured_temp
record.put()
today = datetime.date.today()
todays_records = Record.all().filter('date', today).fetch(3)
template_values = {'temperature': measured_temp,
'order': ORDER[int(time)],
'time': TIME[int(time)],
'city_url': city_url}
if len(todays_records) >= 3:
sum = reduce(lambda a, b: a+b.temperature, todays_records, 0)
template_values['mean'] = round(float(sum) / len(todays_records))
template_values['day'] = today.strftime('%B %d')
self.render_mail(MEASURE_EMAIL_TEMPLATE, template_values)
示例2: Weather
# 需要导入模块: from weather import Weather [as 别名]
# 或者: from weather.Weather import get_temp [as 别名]
from tkinter import *
from weather import Weather
from adapter import SpecialAdapter
kelvin_weather = Weather("")
meteo = SpecialAdapter(kelvin_weather, dict(
get_temp = lambda: (kelvin_weather.get_temp() - 273),
get_temp_min = lambda: (kelvin_weather.get_temp_min() - 273),
get_temp_max = lambda: (kelvin_weather.get_temp_max() - 273)
))
master = Tk()
# Text Input
e = Entry(master)
e.pack()
# Label per la Temperatura
temp = Label(master, text='Temperatura:')
temp.pack()
# Label per visualizzare la temperatura
tempString = StringVar()
tempLabel = Label(master, textvariable=tempString)
tempLabel.pack()
# Label per la Temperatura Minima
tempmin = Label(master, text='Minima:')
tempmin.pack()
# Label per visualizzare la temperatura minima