Split or cut apart a string in Python

Home > Search
  by

The split operator can be used to split a string. In this example, the foo variable is split into the bar variable at each comma.

foo= "data,more data,even more data"

bar = foo.split(',')

print(bar)

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments