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"]
John
  • 37
  • 2

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
  • 363
  • 7