Skip to content

Instantly share code, notes, and snippets.

@drkpkg
Created October 21, 2020 00:38
Show Gist options
  • Save drkpkg/37eccec0b231367eb76183280de96ff1 to your computer and use it in GitHub Desktop.
Save drkpkg/37eccec0b231367eb76183280de96ff1 to your computer and use it in GitHub Desktop.
Multi array to array python
arr = [4, 5, [6, [8, 9]], 10]
arr2 = []
def do_array(a, b):
print(a)
for i in a:
if(isinstance(i, list)):
do_array(i, b)
else:
b.append(i)
do_array(arr, arr2)
print(arr2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment