我开始写
import time
localtime = time.localtime()
print(localtime)
Run Code Online (Sandbox Code Playgroud)
但当地时间给出了九个属性
time.struct_time(tm_year=2018, tm_mon=7, tm_mday=31, tm_hour=22,
tm_min=32, tm_sec=41, tm_wday=1, tm_yday=212, tm_isdst=1)
Run Code Online (Sandbox Code Playgroud)
我想通过将小时:分钟:秒与当地时间进行比较来确定Python中的上午还是下午。请建议