將字符串拆分爲具備多個單詞邊界定界符的單詞 - Split Strings into words with multiple word boundary delimiters

問題:

I think what I want to do is a fairly common task but I've found no reference on the web. 我認爲我想作的是一項至關普通的任務,可是我在網絡上找不到任何參考。 I have text with punctuation, and I want a list of the words. 個人文字帶有標點符號,我想要一個單詞列表。 web

"Hey, you - what are you doing here!?"

should be 應該 網絡

['hey', 'you', 'what', 'are', 'you', 'doing', 'here']

But Python's str.split() only works with one argument, so I have all words with the punctuation after I split with whitespace. 可是Python的str.split()僅適用於一個參數,所以在用空格分割後,全部單詞都帶有標點符號。 Any ideas? 有任何想法嗎? ide


解決方案:

參考一: https://stackoom.com/question/4Rdf/將字符串拆分爲具備多個單詞邊界定界符的單詞
參考二: https://oldbug.net/q/4Rdf/Split-Strings-into-words-with-multiple-word-boundary-delimiters
相關文章
相關標籤/搜索