Category

Python Split and Join Examples

Split and join in python are similar to the equivalent functions in most dynamic languages with a few minor differences:
Python Split
Split a sentence into separate words:

sentence = "the cat sat on the mat"
print sentence.split()
[’the’, ‘cat’, ’sat’, ‘on’, ‘the’, ‘mat’]

Split words separated by a single character:

sentence = "the,cat,sat,on,the,mat"
print sentence.split(’,')
[’the’, ‘cat’, ’sat’, ‘on’, ‘the’, ‘mat’]

Split words separated [...]

Read Full Article

Article Categories

Recommended

Feeds