Skip to content

Instantly share code, notes, and snippets.

@RobertTalbert
Created February 14, 2025 13:38
Show Gist options
  • Save RobertTalbert/8344fe0655c86e914cf069aa37c64816 to your computer and use it in GitHub Desktop.
Save RobertTalbert/8344fe0655c86e914cf069aa37c64816 to your computer and use it in GitHub Desktop.
def flatten_list(lst):
flattened = []
for item in lst:
if isinstance(item, list):
flattened.extend(flatten_list(item))
else:
flattened.append(item)
return flattened
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment