Mar-08-2018, 10:17 PM
Hello Python forum!
I've been trying to solve this issue long enough to make want to seek help
I've basically created a function that contains a loop that goes through a range of values (among other things) and uses the first values of tuples stored in a list as a condition to continue with the next iteration of the loop. What I haven't been able to figure out is how to use or assign the second values of the tuples to each iteration of the output.
Here's the code:
Regards,
jtpy
I've been trying to solve this issue long enough to make want to seek help

I've basically created a function that contains a loop that goes through a range of values (among other things) and uses the first values of tuples stored in a list as a condition to continue with the next iteration of the loop. What I haven't been able to figure out is how to use or assign the second values of the tuples to each iteration of the output.
Here's the code:
srcs = 100 srcids = [] src_prefix = '2/9/1/' jtrange = lambda start, end: range(start, end + 1) def srcidrange(srctart, srcend, idstart, idend): src = [] for i in jtrange(srctart, srcend): src.append(i) ids = [] for i in jtrange(idstart, idend): ids.append(i) srcids.extend(zip(src, ids)) srcidrange(10, 25, 1115, 1130) srcidrange(49, 59, 115, 125) def gen_map(srctrg, prefix): for i in range(srctrg): port_numb = str(i // 768) port_i8s = str((i//8) % 96) chan_numb_gr = str(i % 8) if i not in ([x[0] for x in srcids]): continue print(prefix + port_numb + '/' + port_i8s + '/' + chan_numb_gr + ',' + str(i) + ',' + str(0) + ',' + str(0) + ',\n') gen_map(srcs, src_prefix) print([y[1] for y in srcids]) # values that I want to have come out (in order) with the output of the gen_map function where currently str(i) is being used.Thank you for any help you could provide with this!

Regards,
jtpy