0

I have that string :

a = "Hello, my name is Peter, John"

I tried to split such as :

a.split(",")

But I got that :

["Hello", "my name is Peter", "John"]

But I would like to get that :

["Hello", "my name is Peter, John"]

1 Answers1

0

You can use the second argument of the split function to define how many times you want the string to be spitted (counting from the beginning). Setting it to 1 should solve your problem:

a.split(",", 1)
Blupper
  • 398
  • 1
  • 7