python - If list object contains something remove from list -


i have python script checks folder new files , copies new files directory. files in such format 1234.txt , 1234_status.txt. should move 1234.txt , leave 1234_status.txt unattended.

here's little piece of code in python

    while 1: #retrieves listdir         after = dict([(f, none) f in os.listdir (path_to_watch)]) #if after has more files before, adds new files array "added"         added = [f f in after if not f in before] 

my idea after fills added, checks values have status in , pops array. couldn't find way though : /

thanks in advance, tanel-nils

added = [f f in after if not f in before , '_status' not in f] 

i recommend refrain long 1 line statements make code impossible read


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -