[英]How do I match a word if it starts with a nonalphanumeric character in Python?
[英]how do i find a character in a text and then copy the word that had that character python
我想根據它得到的字符從字符串中提取一個單詞,例如:
字符串:我想在 zeven11 吃奶酪
提取所有包含 11 的單詞
提取:Zeven11
我嘗試了 find() 方法,但后來我只得到了一個單詞的數量
也許是這樣的:
for word in string.split():
if '11' in word: print(word.capitalize()) # first letter?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.