+ 1
How to split list PYTHON
I want to split list . when i do it says split is not a argument of list
5 Respostas
+ 2
Show us the code for better help.
+ 2
list = "1,2,3#4,5,6#7,8,9 10,11,12#13,14,15#"
A = list.split(' ') # first split at space
B = A[0].split('#')
C = B[0].split(',')
print(C)
The error says that you can not use split() with list(arrays).
Yes. You can use split with only strings.
My example can help you.
+ 1
List = [1,2,3#4,5,6#7,8,9 10,11,12#13,14,15#]
A = List.split(' ') # first split at space
B = A[0].split('#')
C = B[0].split(',')
Print(C[0])
+ 1
After this the error is split argument cant be used with list
0
Yes it works. Thanks