How to split list in python?
![](https://pythonpoint.net/wp-content/uploads/2020/12/Blue-and-Green-Stripes-Maximalism-Pets-Influencer-YouTube-Channel-Art-1024x576.jpg)
Splitting list is an important task in lists in python. Here we’ll see some example how we can split a list in python.
e.g.,
l=['a', 'b', 'c', 'd'] a=",".join(l) print(a)
![](https://pythonpoint.net/wp-content/uploads/2020/12/Screenshot-969-1024x520.png)
In the next example we’ll see how we can split the list into two parts.
e.g.,
a=['1', '2', '3', '4'] l=len(a) m=l//2 a1=a[:m] print(a1) a2=a[m:] print(a2)
![](https://pythonpoint.net/wp-content/uploads/2020/12/Screenshot-971-1024x573.png)
This is how we can split list in python.
Subscribe
Login
Please login to comment
0 Discussion