Python String into array

Posted under » Python on 25 July 2022

Just like PHP explode, python too can make string into array

txt = "Hi, My name is LKY, and I love you"
x = txt.split(", ")
print(x)

Setting the maxsplit parameter to 1, will return a list with 2 elements!

x = txt.split(", ", 1)

To see the array,

print (x[0])
print (x[1])
print (x[2])

For Concate string

web security linux ubuntu python django git Raspberry apache mysql php drupal cake javascript css AWS IOT