A = [1,2,3,4,5,6]
B = A[:len(A)//2]
C = A[len(A)//2:]

If you want a function:

def split_list(a_list):
    half = len(a_list)//2
    return a_list[:half], a_list[half:]

A = [1,2,3,4,5,6]
B, C = split_list(A)
Answer from Jason Coon on Stack Overflow
🌐
W3Schools
w3schools.com › python › numpy › numpy_array_split.asp
NumPy Splitting Array
Splitting is reverse operation of Joining. Joining merges multiple arrays into one and Splitting breaks one array into multiple.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-program-to-split-a-list-into-two-halves
Python Program to Split a List into Two Halves - GeeksforGeeks
July 23, 2025 - This function automatically handles splitting the list and is efficient for large datasets. ... import numpy as np a = [1, 2, 3, 4, 5, 6] # Creates two sub-arrays, dividing the list evenly split_lst = np.array_split(a, 2) # Assign the first ...
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.array_split.html
numpy.array_split — NumPy v2.1 Manual
>>> import numpy as np >>> x = np.arange(8.0) >>> np.array_split(x, 3) [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])]
🌐
Python.org
discuss.python.org › python help
How do i split this array into more arrays at each dash? - Python Help - Discussions on Python.org
April 9, 2024 - ['A- 0.5', 'WC- 0.5', 'WC- 0.0', 'n- 0.0', 'WC- 0.3333333333333333', 'ABC- 1.7777777777777777', 'DEF- 1.0', 'GHI- 1.5']
Find elsewhere
🌐
DataCamp
datacamp.com › doc › numpy › split
NumPy split()
The `split()` function is typically used when you need to divide an array into equally sized sub-arrays.
🌐
Codecademy
codecademy.com › article › split-numpy-arrays
How to Split Arrays in NumPy? | Codecademy
NumPy is a powerful, open-source library for scientific computing in Python. It is popular for its efficient handling of multi-dimensional arrays, an essential data structure for performing numerical calculations. In this guide, we’ll discuss in detail how to split NumPy arrays using several functions like np.split(), np.array_split(), np.hsplit(), np.vsplit(), and np.dsplit().
🌐
Imperial College London
python.pages.doc.ic.ac.uk › lessons › numpy › 05-manipulation › 03-split.html
Introduction to NumPy and Matplotlib > Array split | Python Programming | Department of Computing | Imperial College London
>>> x = np.arange(1, 19).reshape((2, 9)) >>> print(x) [[ 1 2 3 4 5 6 7 8 9] [10 11 12 13 14 15 16 17 18]] >>> y = np.split(x, 3, axis=1) # split on axis 1 into 3 evenly-sized sub-arrays >>> print(y[0]) [[ 1 2 3] [10 11 12]] >>> print(y[1]) [[ 4 5 6] [13 14 15]] >>> print(y[2]) [[ 7 8 9] [16 17 18]] >>> y = np.split(x, 2, axis=0) # split on axis 0 into 2 evenly-sized sub-arrays >>> print(y[0]) [[1 2 3 4 5 6 7 8 9]] >>> print(y[1]) [[10 11 12 13 14 15 16 17 18]] >>> y = np.split(x, 4, axis=1) # attempt to split on axis 1 into 4 evenly-sized sub-arrays ValueError: array split does not result in an equal division
🌐
Reddit
reddit.com › r/learnpython › how do i split a list of numbers into equal size (of an array?) to pass into an api as an input?
r/learnpython on Reddit: How do I split a list of numbers into equal size (of an array?) to pass into an API as an input?
January 28, 2025 -

I have a file abc.txt:

1234

2678

3345

4987

5765

6864

7479

I want to split the list into equal chunks (into an array?) so that it looks like this:

group 1: '1234','2678','3345'

group 2: '4987','5765','6864'

group 3: '7479'

the goal is to pass those IDs into an API. I can loop through each one of them single-y but one API call can take 30 values at a time, so it would be more efficient to send chunks of 30. (I have that part of the code working!)

my Python version is 3.6 (I know) , so cant use modules like itertools, etc. I need something easy using simple for, while loops if we can.

this is a follow-up to my original post here.

can anyone help or point me to the right direction. thank you!

🌐
Real Python
realpython.com › how-to-split-a-python-list-into-chunks
How to Split a Python List or Iterable Into Chunks – Real Python
January 27, 2025 - This solution will allow you to split a numeric array into chunks of equal sizes, except for the last chunk, which may be shorter. But you can always append empty elements to it when needed, as in batched_with_padding(). If you don’t have the luxury of installing third-party libraries, such as more-itertools or NumPy, and the itertools module in Python’s standard library doesn’t cut it, then consider writing the splitting code by hand.
🌐
DataCamp
datacamp.com › tutorial › python-split-list
How to Split Lists in Python: Basic and Advanced Methods | DataCamp
June 21, 2024 - Edge cases may occur in Python list split when you fail to account for some scenarios. For example, the snippet below indicates a function trying to split lists into chunks of 5 when the list contains only 4 items. import numpy as np my_list = [1, 2, 3, 4] chunks = np.array_split(my_list, 5) print(chunks) # Expected output: # [array([1]), array([2]), array([3]), array([4]), array([], dtype=int32)]
🌐
VectorBT
vectorbt.dev
Getting started - VectorBT
Strategies and instruments aren't the only things that can act as separate features — time can too. If we want to find out when our strategy performs best, we can backtest over multiple time periods. VectorBT can split one time period into many segments of the same length and frequency and represent them as distinct columns.
🌐
datagy
datagy.io › home › python posts › python lists › python: split a list (in half, in chunks)
Python: Split a List (In Half, in Chunks) • datagy
December 30, 2022 - This function allows you to split an array into a set number of arrays. Let’s see how we can use NumPy to split our list into 3 separate chunks: # Split a Python List into Chunks using numpy import numpy as np a_list = [1, 2, 3, 4, 5, 6, 7, ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › split-a-python-list-into-sub-lists-based-on-index-ranges
Split a Python List into Sub-Lists Based on Index Ranges - GeeksforGeeks
July 23, 2025 - Explanation: List comprehension extracts sub-arrays from a using index ranges in b, slices a[i:j+1] to include the end index, and converts each sub-array to a list with .tolist(). For loop with list append offers a more explicit but less efficient way to split lists.
🌐
LeetCode
leetcode.com › problems › split-array-largest-sum
Split Array Largest Sum - LeetCode
Split Array Largest Sum - Given an integer array nums and an integer k, split nums into k non-empty subarrays such that the largest sum of any subarray is minimized. Return the minimized largest sum of the split.
🌐
Renovate Docs
docs.renovatebot.com › configuration-options
Configuration Options - Renovate Docs
Here's an example where additionalBranchPrefix can help you. Say you're using a monorepo and want to split pull requests based on the location of the package definition, so that individual teams can manage their own Renovate pull requests.
🌐
NumPy
numpy.org › doc › 2.3 › reference › generated › numpy.array_split.html
numpy.array_split — NumPy v2.3 Manual
>>> import numpy as np >>> x = np.arange(8.0) >>> np.array_split(x, 3) [array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])]
🌐
GeeksforGeeks
geeksforgeeks.org › python › splitting-arrays-in-numpy
Splitting Arrays in NumPy - GeeksforGeeks
December 23, 2025 - DSA Python · Data Science · NumPy · Pandas · Practice · Django · Flask · Last Updated : 23 Dec, 2025 · Splitting arrays means dividing a single NumPy array into multiple smaller sub-arrays.
🌐
Udemy
udemy.com › development
Machine Learning A-Z [2026]: ML, DL, AI with AWS, Python & R
June 13, 2026 - The lecture explores various machine learning algorithms and demonstrates how to build, train, and make predictions with ML models using Python. You'll gain hands-on experience with feature engineering, handling missing values, and splitting data into training and test sets.
Rating: 4.5 ​ - ​ 206K votes