Oct-11-2018, 01:19 PM
Hello,
I have a program, which runs well.
It looks like
and else do nothing.
I am trying it like this:
Where is my mistake?
I have a program, which runs well.
It looks like
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('../')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:
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")But it just write out the else statement: NO
Where is my mistake?