Oct-11-2018, 01:19 PM
Hello,
I have a program, which runs well.
It looks like
Now I want to expand it with an if/else statement as an activation flag, something like: if the first argv is 1, run the whole program written above
and else do nothing.
I am trying it like this:
But it just write out the else statement: NO
Where is my mistake?
I have a program, which runs well.
It looks like
1 2 3 4 5 6 7 8 9 10 |
os.chdir( 'zips' ) a = open ( "ziplist.txt" , "w" ) for path, subdirs, files in os.walk(r './' ): for filename in files: if filename.endswith( ".zip" ): commands.... for line in open ( '%s.txt' % (date_ID)).readlines(): if line.startswith( 'range_samples:' ): commands... os.chdir( '../' ) |
and else do nothing.
I am trying it like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
if activate_flag = = 1 : os.chdir( 'zips' ) a = open ( "ziplist.txt" , "w" ) for path, subdirs, files in os.walk(r './' ): for filename in files: if filename.endswith( ".zip" ): commands.... for line in open ( '%s.txt' % (date_ID)).readlines(): if line.startswith( 'range_samples:' ): commands... os.chdir( '../' ) else : print ( "NO" ) |
Where is my mistake?