Split a string into a list of substrings

PHOTO EMBED

Tue Mar 09 2021 09:15:11 GMT+0000 (UTC)

Saved by @francis_cubi

string_1 = "My name is Chaitanya Baweja"
string_2 = "sample/ string 2"

# default separator ' '
print(string_1.split())
# ['My', 'name', 'is', 'Chaitanya', 'Baweja']

# defining separator as '/'
print(string_2.split('/'))
# ['sample', ' string 2']
content_copyCOPY