![](/img/trans.png)
[英]how to remove an item from a list in python if that item contains a word
[英]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.