您的当前位置:首页正文

如何用python获取当前时间(北京时间)

来源:九壹网

import time 

currenttime=time.time()

hour=currenttime//3600

currenthour=int(hour%24)+8

currentminute=int(currenttime%3600//60)

currentseconds=int(currenttime%3600%60)

print(currenthour,":",currentminute,":",currentseconds)

运行后即可显示当前时间

本人为大一初学者,如有写的不好的地方,或错误的地方请及时指出

感谢喜欢

因篇幅问题不能全部显示,请点此查看更多更全内容

Top