19 lines
377 B
Python
19 lines
377 B
Python
import datetime
|
|
import os
|
|
def gettm():
|
|
t= datetime.datetime.now()
|
|
d = str(t)
|
|
return d,d[:10]
|
|
|
|
def save2file(data,isR=1):
|
|
# pass
|
|
t,d = gettm()
|
|
|
|
p = '/'.join(['trlog',d])
|
|
if not os.path.exists(p):
|
|
os.makedirs(p)
|
|
|
|
l=f"{'[R]' if isR else '[T]'} - {t} --- {data}\n"
|
|
f=open('/'.join(['trlog',d,'trlog.txt']),'a')
|
|
f.write(l)
|
|
f.close |