当前位置: 首页>>代码示例>>Python>>正文


Python Weather.lookup方法代码示例

本文整理汇总了Python中weather.Weather.lookup方法的典型用法代码示例。如果您正苦于以下问题:Python Weather.lookup方法的具体用法?Python Weather.lookup怎么用?Python Weather.lookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在weather.Weather的用法示例。


在下文中一共展示了Weather.lookup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getWeather

# 需要导入模块: from weather import Weather [as 别名]
# 或者: from weather.Weather import lookup [as 别名]
def getWeather(forecastIndex):
    weather = Weather()
    lookup = weather.lookup(26237347) #TKO
    #condition = lookup.condition()
    forecasts = lookup.forecast()
    #0 is today, 1 is tomorrow, etc...
    f = forecasts[forecastIndex]
    return  f.text() + ": hight " + str(f2c(f.high())) + " / low " +  str(f2c(f.low()))
开发者ID:AlanFromJapan,项目名称:alanarduinotools,代码行数:10,代码来源:testWeatherInk.py

示例2: getWeather

# 需要导入模块: from weather import Weather [as 别名]
# 或者: from weather.Weather import lookup [as 别名]
def getWeather(forecastIndex):
    weather = Weather(unit=Unit.CELSIUS)
    lookup = weather.lookup(26237347) #TKO
    #condition = lookup.condition()
    forecasts = lookup.forecast
    #0 is today, 1 is tomorrow, etc...
    f = forecasts[forecastIndex]
#    return  [f.text, f2c(f.high), f2c(f.low)]
    return  [f.text, float(f.high), float(f.low)]
开发者ID:AlanFromJapan,项目名称:alanarduinotools,代码行数:11,代码来源:testLayout2.py

示例3: Weather

# 需要导入模块: from weather import Weather [as 别名]
# 或者: from weather.Weather import lookup [as 别名]
For color output
$ pip3 install colorama

WOEID for Lexington, KY is 12775316
"""

from weather import Weather, Unit
from colorama import Fore, Style
import os

# To clear the screen
cls = os.system('clear')

weather = Weather(unit=Unit.FAHRENHEIT)
lookup = weather.lookup(12775316)
condition = lookup.condition
place = lookup.title
forecasts = lookup.forecast

print(Style.BRIGHT)
print("\n" + "Weather for " + place + "\n")
print("Today's date: " + "\t\t\t" + condition.date)
print("Current conditions: " + "\t\t" + condition.text)
print("Current temperature: " + "\t\t" + condition.temp + "F")
print("\n" + "Forecast for Lexington, KY:" + "\n")

for forecast in forecasts:
    print(Fore.MAGENTA + forecast.date + "\t" + 
            Fore.WHITE + "High temp: " + forecast.high + "F" + "\t" +
            "Low temp: " + forecast.low + "F" + "\t" +
开发者ID:cseanburns,项目名称:scripts,代码行数:32,代码来源:lex_weather.py

示例4: getWeather

# 需要导入模块: from weather import Weather [as 别名]
# 或者: from weather.Weather import lookup [as 别名]
def getWeather():
    weather = Weather()
    lookup = weather.lookup(26237347) #TKO
    condition = lookup.condition()
    return condition
开发者ID:AlanFromJapan,项目名称:alanarduinotools,代码行数:7,代码来源:testDrawing.py


注:本文中的weather.Weather.lookup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。