Python String to Array: Quick Conversion Guide
In Python, you can convert a string into an array using the built-in split() method, which splits the string into multiple substrings based on a specified delimiter and stores them in an array.
Here is an example code showing how to convert a comma-separated string into an array:
str = "apple,banana,orange"
arr = str.split(",")
print(arr)
Running the above code will output the following result:
['apple', 'banana', 'orange']
In the split() method, we specified a comma as the delimiter, so the string was divided into three substrings and stored in an array.