我想將一個字符串分解成字[a-zA-Z]
任何特殊字符,它可以包含除@
和#
符號如何將字符串拆分爲單詞和Python中的特殊字符?
message = "I am to be @split, into #words, And any other thing that is not word, mostly special character(.,>)"
預期結果:
['I', 'am', 'to', 'be', '@split', ',', 'into', '#words', ',', 'And', 'any', 'other', 'thing', 'that', 'is', 'not', 'word', ',', 'mostly', 'special', 'character', '(', '.', ',', '>', ')']
我怎麼能在Python中實現這一點?
那麼,你究竟如何定義「單詞」和「特殊字符」呢? – 2014-10-27 13:12:23
@JoelCornett:我的意思是ASCII特殊字符,http://en.wikipedia.org/wiki/Special_characters – Yax 2014-10-27 13:14:26
不應該用''#單詞',''#word',',''? – fredtantini 2014-10-27 13:19:01