27 lines
1013 B
Python
27 lines
1013 B
Python
# -*- coding: utf-8 -*-
|
|
import os,sys,random,string
|
|
import time, datetime
|
|
|
|
|
|
class Common():
|
|
|
|
def __init__(self):
|
|
self.timestamp = int(time.time())
|
|
self.Datetime = time.strftime('%Y%m%d%H%M%S', time.localtime(time.time()))
|
|
self.today_date = datetime.date.today().strftime('%Y-%m-%d')
|
|
self.rootpath = os.path.dirname(os.path.dirname(__file__))
|
|
|
|
def return_folder(self):
|
|
ReportPath = os.path.join(self.rootpath, 'YiMao/reports', str(self.Datetime)).replace("\\", "/")
|
|
if not os.path.exists(ReportPath):
|
|
os.makedirs(ReportPath)
|
|
return ReportPath + '/'
|
|
|
|
def delete_txt_files(self):
|
|
txtPath = os.path.join(self.rootpath, 'YiMao/ProcessData')
|
|
for root, dirs, files in os.walk(txtPath):
|
|
for file_name in files:
|
|
if file_name.endswith('.txt'):
|
|
file_path = os.path.join(root, file_name)
|
|
os.remove(file_path)
|
|
print(f"已删除: {file_path}") |