arr ="[[1,2,3,4],[54,32,-10,-3],[]]"
without_space=[]
for i in arr:
if len(i)!=0:
without_space.append(i)
without_bracket=[]
array=[]
for i in without_space:
if i.startswith("[") and i.endswith("]"):
i=i[1:-2]
elif i.startswith("["):
i=i[1:]
elif i.endswith("]"):
i=i[:-1]
without_bracket.append(i)
print(without_bracket)
I code this but it doesn't work properly.
I want a list to be given to sorting algorithms and sorted by algorithm. If the user accidentally or unknowingly enters values that are not suitable for the array structure that I will use, I want to correct them..ı have this string but ı want to print. This list may be change. It may contain spaces or anything that I cannot use in sorting algorithms.
[[1,2,3,4],[54,32,-10,-3]] input
[1,2,3,4,54,32,-10,-3] output