Python split()Last Updated : 6 Jan 2026 In Python, the split() method is used for splitting a string into several lists of strings. We can break the string with the help of a specified separator. ![]() Syntaxseparator: The string that could be placed between items, also known as a delimiter. maxsplit: It is the number that defines the number of times the strings must be split. -1 is the default value if no value is provided; it means that there is no limit. Example: Split StringCompile and RunOutput: ['T', 'Point', 'Tech'] Splitting the String Using the split() MethodThe split() method is a simple, reliable, and efficient method that enables us to divide a string into multiple lists of substrings based on a specified delimiter. The split method considers spaces like whitespaces, tabs, and newlines as points from where the strings will be separated. Example: split() MethodCompile and RunOutput: ['Hello', 'Welcome', 'to', 'Tpoint', 'Tech', 'for', 'learning'] Let's see another example in which we will split the text consisting of newlines by using the same split() method. It considers newlines are whitespaces, which makes it a point from where the strings get separated. Example: Splitting From New Lines or White SpacesCompile and RunOutput: ['Hello', 'Welcome', 'to', 'Tpoint', 'Tech', 'to', 'learn', 'Python', 'Split'] Defining Number of SplitsMaxsplit is the number that defines the number of times the strings must be split. -1 is the default value if no value is provided; it means that there is no limit. ExampleCompile and RunOutput: Maxsplit:0 ['Welcome, to, T, Point, Tech'] Maxsplit:1 ['Welcome', 'to, T, Point, Tech'] Maxsplit:2 ['Welcome', 'to', 'T, Point, Tech'] Maxsplit:3 ['Welcome', 'to', 'T', 'Point, Tech'] Maxsplit:4 ['Welcome', 'to', 'T', 'Point', 'Tech'] As we can see, if we set maxsplit to 1, it divides into two distinct strings. If we set it to 4, it divides into four different parts. Example: Maxsplit a StringCompile and RunOutput: Laptop: LENOVO Model: IDEAPAD-5 Price: 69999 Stock Status: In-Stock We can also extract particular information, which means that we can access it individually. Example: Accessing particular informationCompile and RunOutput: The Price of the Laptop is: 69999 Split With Different Delimiters Using sep DelimiterIn Python, sep is a type of delimiter that is used to split the CSV (Comma-separated values) file string into multiple substrings. In CSV strings, every line represents a row, and every value which is in the line is separated by commas. Example: Split Using DelimiterCompile and RunOutput: ['Andrew', 'Tom', 'Jack', 'Herris', 'Denial'] Example: Splitting a String Using DelimiterCompile and RunOutput: ['Laptop', 'Silver', '14 inch', 'In Stock'] We can also extract particular information, which means that we can access it individually. Example: Accessing particular InformationCompile and RunOutput: The size of the laptop is: 14 inch Split Strings by LinesThe splitlines() function is used in the case where there are multiple lines of strings and we need to split them into individual lines. Example: splitlines() FunctionCompile and RunOutput: ['Welcome to', 'T point Tech', ' for learning ', ' Python Splits'] Advantages of the splitlines() Function
ConclusionLet's conclude this tutorial by recapping what we learned. We learnt that the Python Split method is used for splitting a string into several list of strings. We can break the string with the help of a specified separator. We learnt about various methods, such as using the split() method, using maxsplit is the number which defines the number of times the strings must be split. We got to know about different delimiters like sep and functions like splitlines(). Next TopicPython-visualizer |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India
