I am looking to get one list of multiple nested list:
list1 = [[1,2],[3,[4,5]],6,[7]] Output --> [1,2,3,4,5,6,7]
I just joined Stack overflow and hence couldn't post my answer to a similar trending question like this.
Hence I am posting my answer here which I thought of to be the fastest, let me know if anyone gets a better solution. Meanwhile, people can refer this for their disposal:
a = str(list1) #Convert list to String
a = a.replace('[','')
a = a.replace(']','') # remove '['&']' from the list use specific brackets for other data structures
# in case of dictionary replace ':' with ','
b=a.split(',') # Split the string at ','
d = [int(x) for x in b]
This should be able to do it for any level of complex list..
Dnyanraj Nimbalkar aka Samrat