I am trying to print out a time with the timezone info as a string in the format '%H:%M:%S%z'. To do this, I am doing the following:
import pytz
import datetime
tz = pytz.timezone('Africa/Cairo')
time = datetime.datetime.strptime('14:24:41', '%H:%M:%S').time()
time = time.replace(tzinfo=tz)
print(time.strftime('%H:%M:%S%z'))
The result I get is simply '14:24:41', even after replacing the tzinfo. What am I doing wrong here?
EDIT
This question is not a duplicate, as the other one does not explain why the timezone is not being printed using the strftime() method.