Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Move to next item in list

$
0
0
I am attempting to utilize a function to save the output of a geoproceessing tool inside a loop. The function iterates thru the list with each iteration of the loop. However if I want to save the output feature class as function " + 1" how do I achieve this. This would be similar to function(count + 1)? Only using characters instead of integers.

Function:
Code:

def get_LCP(letter):
    for letter in ['A','B','C','D','E','F']:
        return os.path.join(savepath  + "\\Scratch.gdb"  + "\\LCP_" + (letter))

Loop:
Code:

    count = 0
    while count < 2:
...
        costPath2 =CostPath(originValue, setNull2,get_backlink(count + 1),"EACH_CELL","")
        costPath2.save(get_LCP(letter).next)


Viewing all articles
Browse latest Browse all 2485

Trending Articles