Created
October 21, 2020 00:38
-
-
Save drkpkg/37eccec0b231367eb76183280de96ff1 to your computer and use it in GitHub Desktop.
Multi array to array python
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
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