I have a general question regarding multiply-nested statements. For "complicated nesting" (>3/4 layers), what is a better approach, especially when iterating AND using if-statements?
I have a lot of files, some of which are in sub-directories, others which are in the root directory. There are a number of directories from which I want to extract datasets and append to a target dataset (the master).
for special_directory in directorylist:
for dataset in special_directory:
if dataset in list_of_wanted:
some_code
if it_already_exists:
for feature_class in dataset:
if feature_class in list_of_wanted:
and then I really get into the meat of the code processing. Frankly, I can't think of a way to avoid these nested conditional and looping statements. Is there something I am missing? Should I be using "while" instead of "for"?
My actual specific code works. It just doesn't move very quickly. It is iterating over 27 databases to append the contents of each to a new target database. My python has been running for 36 hours and is through 4/27. Tips?
I posted this in the GIS stack exchange, but my question is really too general for it to belong there: question and more specific code
Aucun commentaire:
Enregistrer un commentaire