Я пытаюсь получить выходные данные, включая название страны и прогнозирую, будет ли там день или ночь. Сложно найти название страны.
Я попытался получить доступ к индексу time.gmtime (), преобразовав модуль времени в список и в состоянии предсказать его день или ночь
код
from time import gmtime, strftime
import time
print("International Institute of Weather Forecasting
AGENCY(IIWA)\nDay or Night Prediction Module")
print(time.gmtime())
"""convert the time to list and assign to my time variable """
mytime = list(time.gmtime())
print("so now you will get the time variables in a list:\n",mytime)
print(type(time.gmtime()))
print("Today complete time details as of now:",strftime("%a, %d %b %Y
%H:%M:%S +0000", gmtime()))
def weather_forcasting_day_night_prediction(mytime):
if (mytime[3] >= 18):
print("Its night:Officially declared by IIWA weather forcasting
station ")
else:
print("Its day:Officially declared by IIWA weather forcasting
station")
weather_forcasting_day_night_prediction(mytime)
АКТУАЛЬНЫЕ РЕЗУЛЬТАТЫ
Time_Module_predict_day_or_night.py
International Institute of Weather Forecasting AGENCY(IIWA)
Day or Night Prediction Module
time.struct_time(tm_year=2019, tm_mon=6, tm_mday=21, tm_hour=20,
tm_min=13, tm_sec=1, tm_wday=4, tm_yday=172, tm_isdst=0)
so now you will get the time variables in a list:
[2019, 6, 21, 20, 13, 1, 4, 172, 0]
<class 'time.struct_time'>
Today complete time details as of now: Fri, 21 Jun 2019 20:13:01
+0000
Its night:Officially declared by IIWA weather forcasting station
Process finished with exit code 0
Я ожидаю и пытаюсь напечатать название страны, где бы ни выполнялся мой код, используя свойства сети IP и WIFI