반응형 [Python] NTP 서버에서 시간 가져오기 파이썬으로 NTP 서버에서 시간 가져오는 샘플입니다. ntplib 를 사용하고 다음과 같이 라이브러리가 설치되어 있지 않으면 pip 로 설치합니다. ModuleNotFoundError: No module named 'ntplib' ntplib 설치 $> pip install ntplib Sample Source (ntp.py) import ntplib from time import ctime def print_time(NTP_Server): ntp_client = ntplib.NTPClient() response = ntp_client.request(NTP_Server) print(ctime(response.tx_time)) if __name__ == '__main__': print_time('time... 2022. 9. 28. 이전 1 다음