Strings in python can be split using any given delimeter. Unlike other languages, the delimeter can be a string of any length; it’s not limited to one character. To do this, you can use the <string>.split(<delimeter>) function.

Similarly, you can join an array of strings back into one string, using any defined string to join them. This is done using <joining_string>.join(<array>).

For example, you can use the following code to split a given sentence into an array of words, broken up by the space character, and recreate the sentence with underscores between the words like so:

original = "There are 206 bones in the typical adult human skeleton"
words = original.split(" ")
rebuilt = "_".join(words)

print "Original: " + original
print "Split: " + str(words)
print "Rebuilt: " + rebuilt

This will print:

Original: There are 206 bones in the typical adult human skeleton
Split: ['There', 'are', '206', 'bones', 'in', 'the', 'typical', 'adult', 'human', 'skeleton']
Rebuilt: There_are_206_bones_in_the_typical_adult_human_skeleton