Solved: python string to list without split

The main problem with trying to convert a Python string to a list without using the split() function is that the string may not be wide enough to hold all of the data in the list. If the string is not wide enough, Python will truncate it at the first non-whitespace character.


l = list(s)

This code creates a list from the string s.

Split

In Python, a split is a string operation that takes two strings as input and produces two strings as output. The first string is divided evenly into the second string, with the result being placed in the second string.

List function

The List function in Python returns a list of items. The items in the list are accessed by using the index number, starting from zero.

Related posts:

Leave a Comment