Working on a larger project and wanted to know if anyone could help with a Python script. I’m trying to have two lists be interwoven (1234, ABCD = 1A2B3C4D), and I’m fairly close but it isn’t behaving how I expect. Here’s the code:
tab = op('table1')
listRange1 = op('in1').numRows
listRange2 = op('in2').numRows
for index in range(listRange1):
list1 = op('in1')[index,0]
list2 = op('in2')[index,0]
Thanks in advance!
If you can work without Python, you could try perhaps a merge DAT?
set to Collapse Rows (or collapse columns) and clear the Concatenate field
I hope this helps! or maybe I have misunderstood the scenario and the outcome you are after?
You can look at zip and some nested for-loops if you need it like this:
for zipped_row in zip(*[input.rows() for input in scriptOp.inputs]) :
for row in zipped_row:
for cell in row:
This is close! Though I was wanting more of a A in (0,0), 1 in (1,0), etc
Tried this, but I get an “inconsistent tabs and indentations” error message. The code is verbatim so not sure if I’m just missing something.
ok! just change the Merge DAT to “append columns” instead of “collapse row/columns”
This seems to give me two columns, but I’m trying to have an output similar to what @alphamoonbase showed in their example, wherein the two lists are mixed.
Ok sorry, I misunderstood the outcome you were after.
No worries! I believe I have found a means to do this
Just for my own fun & curiosity… nothing against some good Python, but it works all with DATs!
Nice to know it’s possible with both!