Initialize a 2d array in python

From AcrodusWiki
Revision as of 06:45, 20 January 2025 by Alex (talk | contribs) (Created page with "To save future Alex issue with this again, just initialise the array like this <pre> cables_type_arr = [[''] for i in range(int_inc)] </pre> And then append each element array like so <pre> cables_type_arr[i].append(record['Type']) </pre> This example was taken from the cable route analysis tool.")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

To save future Alex issue with this again, just initialise the array like this

cables_type_arr = [[''] for i in range(int_inc)]

And then append each element array like so

cables_type_arr[i].append(record['Type'])

This example was taken from the cable route analysis tool.