import time, datetime def gettime(): for x in range(24): a = datetime.datetime.now().strftime("%Y-%m-%d") + " %2d:00:00" % x timeArray = time.strptime(a, "%Y-%m-%d %H:%M:%S") timeStamp = int(time.mktime(timeArray)) print(time
python 获取 mac 地址 的例子,有需要的朋友可以参考下. #!/bin/python import os import re def GetMac(): if os.name == 'nt': try: ret = '' CmdLine = 'ipconfig /all' r = os.popen(CmdLine).read() if r: