You could use Beautiful Soup! to get your desired data between specific html tags. If you want to do it yourself you could post your data by calling the site's api. first install requests. pip install requests
then
import re
import requests
# the data is between align="left"><font size="3px"> and </font> in each specific part so we use re to find it
def find_data(line):
return re.search('align="left"><font size="3px">(.*?)</font>', line).group(1)
params = {
'tags': city_name,
'submit': 'Go'
}
response = requests.post('http://www.indiaweather.gov.in/?page_id=942', data=params).content.splitlines()
try:
current_temp = find_data(response[357])
max_temp = find_data(response[362])
min_temp = find_data(response[369])
last_day_rainfall = find_data(response[376])
current_wind_direction = find_data(response[382])
current_wind_speed = find_data(response[389])
current_dew_point = find_data(response[396])
current_sea_level_pressure = find_data(response[403])
print(current_temp, max_temp, min_temp, last_day_rainfall, current_wind_direction, current_wind_speed,
current_dew_point, current_sea_level_pressure)
except IndexError:
print('No Info Found For %s' % params['tags'])