
pytz 모듈은 시간대 이름을 지정할 때 사용하는 tzinfo 객체를 반환합니다. timezone_identifiers_list는 시간대 이름 목록을 반환하는 데 사용됩니다.
이러한 경우, 시간대 이름을 지정할 때 오류가 발생하는 이유는 timezone_identifiers_list에 시간대 이름이 포함되어 있지 않기 때문입니다.
따라서 timezone_identifiers_list에 'Asia/Seoul' 시간대 이름이 포함되어 있는지 확인하려면 다음과 같이 코드를 작성할 수 있습니다.
#hostingforum.kr
python
import pytz
timezone_identifiers_list = pytz.common_timezones
print('시간대 이름 목록:')
print(timezone_identifiers_list)
if 'Asia/Seoul' in timezone_identifiers_list:
print("'Asia/Seoul' 시간대 이름이 포함되어 있습니다.")
else:
print("'Asia/Seoul' 시간대 이름이 포함되어 있지 않습니다.")
위 코드를 실행하면 'Asia/Seoul' 시간대 이름이 포함되어 있는지 확인할 수 있습니다.
만약 'Asia/Seoul' 시간대 이름이 포함되어 있지 않다면, timezone_identifiers_list에 포함되어 있는지 확인할 수 있습니다.
#hostingforum.kr
python
import pytz
timezone_identifiers_list = pytz.common_timezones
print('시간대 이름 목록:')
print(timezone_identifiers_list)
if 'Asia/Seoul' in timezone_identifiers_list:
print("'Asia/Seoul' 시간대 이름이 포함되어 있습니다.")
else:
print("'Asia/Seoul' 시간대 이름이 포함되어 있지 않습니다. 포함되어 있는 시간대 이름 목록:")
for tz in timezone_identifiers_list:
if 'Seoul' in tz:
print(tz)
위 코드를 실행하면 'Asia/Seoul' 시간대 이름이 포함되어 있지 않다면, 포함되어 있는 시간대 이름 목록을 출력할 수 있습니다.
2025-05-23 16:12