Rose
Rose

Reputation: 103

Join two word in a item from a list python

I have this list:

['Fantasy', 'Young Adult', 'Paranormal', 'Paranormal Romance']

Is it possible to join the two words in an item like 'Young.Adult'

I mean in general, not for that two words(the list only contains max two words).

Upvotes: 0

Views: 114

Answers (1)

Patrick Klein
Patrick Klein

Reputation: 1191

That should do it:

for word in ['Fantasy', 'Young Adult', 'Paranormal', 'Paranormal Romance']:
    print(word.replace(" ", "."))

Upvotes: 2

Related Questions