#得到話單文件后綴
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
文章來源于領測軟件測試網 http://www.kjueaiud.com/