Python list true false statement -


i have question python list, how can iterate backwards setting buffer on list? mean keep in memory if path not true, iterate again? code example:

def clientthread(conn):      #infinite loop function not terminate , thread not end.     # array of input data, check complete transaction pid       while true:         # recive true data          data = conn.recv(4069)           newpid = os.fork()         if newpid == 0:             child()         else:             bufsize = 0             input_data = []             input_miss = []             if data:                 # check data                 pids = (os.getpid(), newpid)                 print "parent: %d, child: %d" % pids                 # split line                 word = data.split(';')                      if word[0] == "start":                     channel     = word[2]                     filename    = word[6].rstrip()                     yearmonth   = word[3]                     channelid   = word[1]                     videostart  = word[5]                     day         = word[4]                      file_name   = path_images+channel+'/'+yearmonth+'/'+day+'/'+filename+'/'+filename+'.txt'                     create_file = open(file_name,'w+', bufsize)                  elif word[0] == "end":                     # end loop if come end                        break                  else:                     if pids:                         slika = path_images+channel+'/'+yearmonth+'/'+day+'/'+filename+'/'+filename+'_'+word[0]+".jpg"                         input_data.append(slika)                  # loop reading images buffer, , try make hash on each, if fails stay opened till end come, on succed remove array                 image in input_data:                     if os.path.exists(image):                         #print image                         hash1 = phash.imagehash(image)                         #print hash1                         print >> create_file ,filename+","+channelid+","+yearmonth+","+word[0]+","+str(hash1)+","+word[1].rstrip()+","+videostart                                           input_data.remove(image)                           if not os.path.exists(image):                             input_miss.append(image)                               print image                       else:                         miss in input_miss:                             if os.path.exists(miss):                                 hash_miss = phash.imagehash(miss)                                 print hash_miss + 'check on'                                 print >> create_file ,filename+","+channelid+","+yearmonth+","+word[0]+","+str(hash_miss)+","+word[1].rstrip()+","+videostart                                                   input_miss.remove(miss)                else:                  time.sleep(60)       #came out of loop     conn.close() 

i'm expecting value, , checking path every image. question is, how can save variable in array when it's not true, , start process again on when image comes.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -