python 获取系统时间,新建时间目录
import datetime import os theTime = datetime.datetime.now() print(theTime) theTime = str(theTime) date_split = theTime.strip().split(' ') date_today = date_split[0].replace('-', '_') date_clock = date_split[-1] date_clock = date_clock.strip().split('.')[0] date_clock = date_clock.replace(':', '_') date_show = date_today + '-' + date_clock print(date_show) out_path = "./" + date_show if not os.path.isdir(out_path): os.makedirs(out_path)