Splitting and Joining Strings: split(), join() in Python


Split a string into a list or join a list into a string.

Source Code

sentence = "This is a sentence."
words = sentence.split()
print(words)

sentence_again = " ".join(words)
print(sentence_again)
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments