from datetime import datetime, timedeltaget
import osit
PWD = 'a1234567'import
FILE_path = os.getcwd() +'/log_jiexheng/'date
def log_set(msg, name ='main'):im
now_time = datetime.now()datetime
yes_date = now_time + timedelta(days=-1)touch
str_now = str(now_time).split('.')[0]di
str_yes = str(yes_date).split('.')[0]time
FILE_yes = FILE_path +'%s%s'%(name, str_yes)path
FILE_main = FILE_path +'%s%s'%(name, str_now)
#print(FILE_yes[:-9],FILE_main[:-9])
try:
os.system('mkdir -p %s ;touch %s' % (FILE_path, FILE_main[:-9]))
#os.system('mkdir -p %s ;rm %s ;touch %s' % (FILE_path, FILE_yes[:-9],FILE_main[:-9]))
except:
pass
f = open('%s' % FILE_main[:-9], 'a+')
f.write('[' + str(datetime.now()).split('.')[0] + ']' + msg + '\n')
f.close()