Here is the added code. The final code I'll put up again after verification.
Click on "View Raw" at the bottom of the box to see the entire code that goes out view.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loop_branches=[] | |
for c1 in range(len(loop_list)): | |
if len(loop_list[c1])==2: | |
loop_updt=[] | |
#for c2 in range(2): | |
curr_br=loop_list[c1][0] | |
for c2 in range(len(branch_map[curr_br[0]][curr_br[1]][0])): | |
loop_updt.append(branch_map[curr_br[0]][curr_br[1]][0][c2]) | |
for c2 in range(len(branch_map[curr_br[0]][curr_br[1]][1])-2, -1, -1): | |
loop_updt.append(branch_map[curr_br[0]][curr_br[1]][1][c2]) | |
else: | |
loop_updt=[] | |
for c2 in range(0, len(loop_list[c1])-1): | |
curr_br=loop_list[c1][c2] | |
curr_br_beg=branch_map[curr_br[0]][curr_br[1]][0][0] | |
curr_br_end=branch_map[curr_br[0]][curr_br[1]][0][-1] | |
next_br=loop_list[c1][c2+1] | |
next_br_beg=branch_map[next_br[0]][next_br[1]][0][0] | |
next_br_end=branch_map[next_br[0]][next_br[1]][0][-1] | |
curr_dir="forward" | |
if not loop_updt: | |
if curr_br_beg==next_br_beg or curr_br_beg==next_br_end: | |
curr_dir="reverse" | |
else: | |
if curr_br_end==loop_updt[-1]: | |
curr_dir="reverse" | |
if curr_dir=="forward": | |
for c3 in range(len(branch_map[curr_br[0]][curr_br[1]][0])): | |
loop_updt.append(branch_map[curr_br[0]][curr_br[1]][0][c3]) | |
else: | |
for c3 in range(len(branch_map[curr_br[0]][curr_br[1]][0])-1, -1, -1): | |
loop_updt.append(branch_map[curr_br[0]][curr_br[1]][0][c3]) | |
next_dir="forward" | |
if next_br_end==loop_updt[-1]: | |
next_dir="reverse" | |
if next_dir=="forward": | |
for c3 in range(len(branch_map[next_br[0]][next_br[1]][0])): | |
loop_updt.append(branch_map[next_br[0]][next_br[1]][0][c3]) | |
else: | |
for c3 in range(len(branch_map[next_br[0]][next_br[1]][0])-1, -1, -1): | |
loop_updt.append(branch_map[next_br[0]][next_br[1]][0][c3]) | |
for c3 in range(len(loop_updt)-1, 0, -1): | |
if loop_updt[c3]==loop_updt[c3-1]: | |
del loop_updt[c3] | |
loop_branches.append(loop_updt) | |
excel_col="A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" | |
excel_dict={} | |
excel_col_list=excel_col.split(" ") | |
for c1 in range(26): | |
excel_dict[c1]=excel_col_list[c1] | |
for item in loop_branches: | |
for c1 in range(len(item)): | |
print str(item[c1][0]+1) + excel_dict[item[c1][1]], | |
No comments:
Post a Comment