Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python get weather

# Get Weather in Python 
# pip install python-weather
import asyncio
import python_weather as weather
async def Get_Weather():
    client = weather.Client(format= weather.IMPERIAL)
    w = await client.find("New York")
    print("Temperature: ", w.current.temperature)
    for forecast in w.forecasts:
        print("Forecast: ", forecast.sky_text, forecast.temperature)
    await client.close()
if __name__ == "__main__":
  loop = asyncio.get_event_loop()
  loop.run_until_complete(Get_Weather())
Source by python.plainenglish.io #
 
PREVIOUS NEXT
Tagged: #python #weather
ADD COMMENT
Topic
Name
2+2 =