此程序用于查找某个国家的当前位置时间
时间,然后得到你选择的地点的时间。我需要知道如何从其他国家,如中国或代码中的国家获得时间。在
#Eric's Amazing Trip around the world in 80 days time converter#
import time
print("Welcome to Eric's Amazing Trip around the world in 80 days time converter")
print("This program helps the user change the time on the watch as they travel")
cur=input("First enter the current country")
#Displays the country of your choosing time#
print("The current time in " + cur)
#Displays the current time in the country#
print("Current time is " + time.asctime())
print()
nex=input("Next the country your travelng to")
#This display the time of whichever country you choose#
if cur=="Italy" or "italy":
print("The current time in " + nex + "is")
elif cur=="Egypt" or "Egypt":
print("The current time in " + nex + "is")
elif cur=="Paris" or "Paris ":
print("The current time in " + nex + "is")
elif cur=="China" or "china":
print("The current time in " + nex + "is")
elif cur=="India" or "india":
print("The current time in" + nex + "is")
elif cur=="Singapore" or "Singaspore":
print("The current time in " + nex + "is")
一般来说,一个国家可能有多个时区,例如,俄罗斯有21个时区:
不同时区可能具有不同的utc偏移量。在
虽然在你的例子中,除了中国以外,所有国家都有一个时区:
^{pr2}$一旦您选择了一个特定的时区,例如
Asia/Shanghai
,就很容易找到其中的当前时间:相关问题 更多 >
编程相关推荐