how to split text in python

how to split text in python

example-1: split text

1
2
3
4
var = "hello world"
#split as list
spl = var.split(' ')
print(spl)

output

1
"['hello', 'world']"

example-2

1
2
3
4
var = "hello/world"
#split as list
spl = var.split('/')
print(spl)

output

1
"['hello', 'world']"