Время тока Python с использованием модуля времени
import time
t = time.localtime()
current_time = time.strftime("%H:%M:%S", t)
print(current_time)
SAMER SAEID
import time
t = time.localtime()
current_time = time.strftime("%H:%M:%S", t)
print(current_time)
from datetime import datetime
import pytz
tz_NY = pytz.timezone('America/New_York')
datetime_NY = datetime.now(tz_NY)
print("NY time:", datetime_NY.strftime("%H:%M:%S"))
tz_London = pytz.timezone('Europe/London')
datetime_London = datetime.now(tz_London)
print("London time:", datetime_London.strftime("%H:%M:%S"))