簡體   English   中英

在列表中的項目中加入兩個單詞 python

[英]Join two word in a item from a list python

我有這個清單:

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

是否可以將這兩個詞加入到像'Young.Adult'這樣的項目中

我的意思是一般來說,不是那兩個詞(列表只包含最多兩個詞)。

那應該這樣做:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM