#得到话单文件后缀
self.data_postfix = config_list[4][config_list[4].strip().find(\"=\")+1:-1]
#得到话单文件当前数据号
self.data_number = \"%04d\" % int(config_list[5][config_list[5].strip().find(\"=\")+1:])
self.data_path = self.initialization_path+\"config\\\"+self.data_prefixion+self.data_data+self.data_infix+self.data_number+self.data_postfix
#得到程序需要运行的次数 [Page]
self.data_count = config_list[6][config_list[6].strip().find(\"=\")+1:]
def get_localtime(self):
#获取本地时间,For Example:2008/10/02 00:44:11
nowtime = time.localtime()
#print nowtime
data1,time1 = \"\",\"\"
for i in range(3):
#如果获得时间是单数,则需要补位0
data1 += (\"%02d\" % nowtime[i])+’/’
#获得时间片的日期测试print data1[0:-1]
for i in range(3,6):
#如果获得日期是单数,则需要补位0
time1 += (\"%02d\" % nowtime[i])+’:’
#获得时间片的时间测试print time1[0:-1]
#时间片的数据组合
time_area = data1[0:-1]+\" \"+time1[0:-1]
return time_area
def data_control(self):
#得到需要重写话单文件的路径及命名self.data_count
count = 0
data_time = self.data_data
data_number = self.data_number
dd = 1
for i in range(int(self.data_count)):
i += 1
last_time = data_time
last_data_number = data_number
temp = dd
last_count = i
if dd != 1:
last_count = last_count - end_count [Page]
#i += 1
#增加话单数据文件序号隔天重新计数
nowtime = time.localtime()
data_time = \"\"
for y in range(3):
#如果日期为单数需要补零
data_time += \"%02d\" % nowtime[y]
if data_time == last_time:
last_data_number = data_number
else:
#重置循环次数
end_count = i
last_count = 0
文章来源于领测软件测试网 https://www.ltesting.net/