如何使用bash或python从互联网上查看时间?

时间:2017-07-28 04:13:53

标签: python bash time ntp

这应该是一个非常简单的任务,但经过2个小时的搜索和阅读文档后,我找不到使用bash或python从互联网上查看日期和时间的方法,而无需安装任何额外的东西,如ntplib。

我基本上在寻找相当于pythons now()或bash $ date,但是使用NTP(或任何其他方式)从互联网上获取正确的日期和时间。我找到的所有方法(例如ntpd)都是为了纠正系统时间,这不是我的目的。

1 个答案:

答案 0 :(得分:0)

Screenshot of the line that shows in between the tabs when a tab is grabbed

sentence = open('sentences.txt', 'r')
sentence_list = []
new_sentence_list = []
for line in sentence:
    line = line.rstrip('\n')
    sentence_list.append(line)
for line in sentence_list:
    line = list(line)
    # line = [line]
    new_sentence_list.append(line)